:root {
  --primary-300: #A5B4FC;
  --primary-400: #818CF8;
  --primary-500: #6366F1;
  --primary-600: #4F46E5;
  --primary-700: #4338CA;

  --bg-primary: #0B0B0D;
  --bg-secondary: #1D1D1D;
  --bg-tertiary: #252525;
  --bg-elevated: #2A2A2A;

  --border: #323232;
  --border-light: #404040;

  --text-primary: #FFFFFF;
  --text-secondary: #E5E5E5;
  --text-tertiary: #A0A0A0;

  --font-primary: "Space Grotesk", sans-serif;
  --font-secondary: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

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

html { scroll-behavior: smooth; }

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-secondary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}



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

/* top accent line (removed) */
.top-accent { display: none; }

/* starfield + glow (hero region only) */
.stars {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}
.hero-glow {
  position: absolute;
  top: 50vh; left: 50%;
  width: 900px; height: 900px;
  transform: translate(-50%, -55%);
  background: radial-gradient(circle, rgba(99,102,241,0.07) 0%, rgba(99,102,241,0.02) 35%, rgba(0,0,0,0) 70%);
  z-index: 0;
  pointer-events: none;
}

/* navbar */
.navbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 24px;
}
.brand-prompt { color: var(--primary-500); }
.brand-name {
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
}
.nav-links a {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  transition: color .15s ease;
}
.nav-links a:hover { color: var(--text-primary); }
.ico {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-secondary);
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn-ghost {
  padding: 9px 20px;
  font-size: 15px;
  border: 1px solid var(--primary-500);
  color: var(--text-primary);
  background: transparent;
}
.btn-ghost:hover { background: rgba(99,102,241,0.12); }

.btn-primary {
  padding: 9px 22px;
  font-size: 15px;
  background: var(--primary-500);
  color: #fff;
  border: 1px solid var(--primary-500);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }

.btn-lg {
  padding: 16px 30px;
  font-size: 15px;
  letter-spacing: 1.5px;
  font-weight: 600;
  border-radius: 12px;
}
.btn-glow {
  box-shadow: 0 0 40px rgba(99,102,241,0.55), 0 0 12px rgba(99,102,241,0.4);
}
.btn-glow:hover { box-shadow: 0 0 55px rgba(99,102,241,0.7), 0 0 16px rgba(99,102,241,0.5); }
.chev { font-size: 20px; line-height: 1; transform: translateY(-1px); }

.btn-dark {
  background: linear-gradient(180deg, #232325 0%, #1a1a1c 100%);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-dark:hover { background: #2a2a2c; border-color: #4a4a4a; }

/* hero */
.hero {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - 88px);
  padding: 0 20px;
}
.hero-title {
  font-family: var(--font-primary);
  font-weight: 900;                 /* font-black */
  font-size: 3.75rem;               /* text-6xl (base) */
  line-height: 1;
  letter-spacing: -0.05em;          /* tracking-tighter */
  margin-bottom: 1.5rem;            /* mb-6 */
  background: linear-gradient(to right, #ffffff, #e5e7eb, #6366F1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
@media (min-width: 768px) {
  .hero-title { font-size: 6rem; }  /* md:text-8xl */
}
.hero-subtitle {
  max-width: 52rem;            /* élargi pour un wrap en 2 lignes */
  margin: 0 auto 3rem;        /* mx-auto + mb-12 */
  font-size: 1.125rem;        /* text-lg (base) */
  line-height: 1.625;         /* leading-relaxed */
  font-weight: 400;
  color: #9a9aa5;
}
@media (min-width: 768px) {
  .hero-subtitle { font-size: 1.25rem; }  /* md:text-xl */
}
.hero-buttons {
  margin-top: 0;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---- shared section bits ---- */
section { position: relative; z-index: 2; }
.section-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  letter-spacing: -1px;
  text-align: center;
  color: #fff;
}
.section-title.sm { font-size: clamp(28px, 4vw, 40px); }
.section-title.left { text-align: left; }
.grad {
  background: linear-gradient(180deg, #a5a7f0 0%, #6366F1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.amp { color: var(--primary-400); }
.section-sub {
  margin: 18px auto 0;
  max-width: 720px;
  text-align: center;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-tertiary);
}
.center-btn { display: flex; width: max-content; margin: 46px auto 0; }
.btn-md { padding: 13px 26px; font-size: 15px; border-radius: 10px; }

/* ---- sponsors ---- */
.sponsors { padding: 90px 24px 70px; max-width: 1200px; margin: 0 auto; scroll-margin-top: -48px; }
.marquee { margin-top: 46px; overflow-x: hidden; overflow-y: visible; padding-block: 14px; mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; align-items: center; gap: 90px; width: max-content; animation: scroll-x 28s linear infinite; }
.sponsor-logo {
  height: 64px; width: auto; object-fit: contain;   /* h-16 */
  opacity: .7;                                       /* opacity-70 */
  filter: grayscale(1) brightness(1.4);
  transition: all .3s ease;                          /* transition-all duration-300 */
}
.sponsor-logo:hover {
  opacity: 1;
  filter: grayscale(0) brightness(1);
  transform: scale(1.12);
}
.sponsor-logo[alt="OffSec"],
.sponsor-logo[alt="Caido"] { height: 80px; }   /* OffSec & Caido un peu plus grands */
@keyframes scroll-x { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- battlefield ---- */
.battlefield { padding: 70px 24px; max-width: 1200px; margin: 0 auto; }
.cat-grid { margin-top: 46px; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.cat-pill {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: 92px; height: 88px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  transition: all .18s ease;
}
.cat-pill:hover { border-color: var(--primary-500); background: var(--bg-tertiary); transform: translateY(-3px); }
.cat-ico { width: 22px; height: 22px; fill: none; stroke: var(--primary-400); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- machines ---- */
.machines { padding: 70px 24px; max-width: 1200px; margin: 0 auto; }
.os-grid { margin-top: 54px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.os-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; padding: 26px; }
.os-head { display: flex; gap: 16px; }
.os-icon { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: rgba(99,102,241,0.12); border-radius: 10px; color: var(--primary-400); }
.os-head h3 { font-family: var(--font-primary); font-size: 21px; font-weight: 600; }
.os-head p { margin-top: 6px; font-size: 14px; color: var(--text-tertiary); line-height: 1.45; }
.tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.tag { font-size: 12px; padding: 4px 11px; border-radius: 20px; background: rgba(99,102,241,0.14); color: var(--primary-300); }
.tag.red { background: rgba(239,68,68,0.14); color: #fca5a5; }
.os-foot { margin-top: 20px; font-size: 14px; }
.os-foot.muted { color: var(--text-tertiary); }
.os-foot strong { color: var(--primary-400); }

.feature-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; padding: 28px; text-align: center; }
.feature-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(99,102,241,0.12); color: var(--primary-400); margin-bottom: 16px; }
.feature-card h4 { font-family: var(--font-primary); font-size: 17px; font-weight: 600; }
.feature-card p { margin-top: 10px; font-size: 14px; color: var(--text-tertiary); line-height: 1.5; }

/* ---- library ---- */
.library { padding: 70px 24px; max-width: 1200px; margin: 0 auto; }
.lib-grid { margin-top: 54px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.ctf-list { display: flex; flex-direction: column; gap: 18px; }
.ctf-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.ctf-top { display: flex; align-items: flex-start; gap: 14px; }
.ctf-icon { flex: none; width: 38px; height: 38px; display: grid; place-items: center; background: rgba(99,102,241,0.12); border-radius: 9px; color: var(--primary-400); }
.ctf-name { flex: 1; }
.ctf-name h3 { font-family: var(--font-primary); font-size: 17px; font-weight: 600; }
.ctf-name p { font-size: 13px; color: var(--text-tertiary); margin-top: 3px; }
.badge-avail { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: rgba(34,197,94,0.14); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.ctf-meta { display: flex; gap: 22px; margin-top: 16px; }
.meta { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-tertiary); }
.ico-sm { width: 15px; height: 15px; fill: none; stroke: var(--primary-400); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ctf-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; margin-left: auto; width: max-content; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--primary-400); border: 1px solid var(--border-light); border-radius: 8px; transition: all .15s; }
.ctf-btn:hover { border-color: var(--primary-500); background: rgba(99,102,241,0.08); }

.repo-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.repo-head { display: flex; align-items: center; gap: 12px; }
.repo-icon { width: 38px; height: 38px; display: grid; place-items: center; background: rgba(99,102,241,0.12); border-radius: 9px; color: var(--primary-400); }
.repo-head h3 { font-family: var(--font-primary); font-size: 20px; font-weight: 600; }
.repo-desc { margin-top: 16px; font-size: 14px; color: var(--text-tertiary); line-height: 1.55; }
.repo-feature { display: flex; gap: 14px; margin-top: 20px; }
.rf-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; background: rgba(99,102,241,0.1); border-radius: 9px; color: var(--primary-400); }
.repo-feature h4 { font-size: 15px; font-weight: 600; }
.repo-feature p { font-size: 13px; color: var(--text-tertiary); margin-top: 4px; line-height: 1.45; }
.repo-org { margin-top: 24px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.repo-org h4 { font-size: 15px; font-weight: 600; }
.repo-org p { font-size: 13px; color: var(--text-tertiary); margin-top: 8px; line-height: 1.5; }
.repo-org ul { margin-top: 12px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.repo-org li { font-size: 13px; color: var(--text-secondary); padding-left: 16px; position: relative; }
.repo-org li::before { content: "•"; position: absolute; left: 2px; color: var(--primary-400); }
.repo-cta { display: flex; width: 100%; margin-top: 22px; padding: 13px; }

/* ---- ranks ---- */
.ranks { padding: 70px 24px; max-width: 1200px; margin: 0 auto; }
.ranks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.ranks-sub { margin-top: 18px; font-size: 15px; color: var(--text-tertiary); }
.rank-feature { display: flex; gap: 16px; margin-top: 26px; }
.rkf-icon { flex: none; width: 42px; height: 42px; display: grid; place-items: center; background: rgba(99,102,241,0.12); border-radius: 10px; color: var(--primary-400); }
.rank-feature h4 { font-family: var(--font-primary); font-size: 17px; font-weight: 600; }
.rank-feature p { font-size: 14px; color: var(--text-tertiary); margin-top: 5px; line-height: 1.45; }

.rank-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 0 60px rgba(99,102,241,0.08); }
.rc-head { display: flex; align-items: center; gap: 14px; }
.rc-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-500); display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff; }
.rc-title { flex: 1; }
.rc-title h3 { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.rc-title p { font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }
.rc-pts { font-size: 13px; font-weight: 700; color: var(--primary-300); background: rgba(99,102,241,0.14); padding: 6px 12px; border-radius: 8px; }
.rc-progress-row { display: flex; justify-content: space-between; margin-top: 24px; font-size: 13px; color: var(--text-tertiary); }
.rc-bar { margin-top: 10px; height: 8px; border-radius: 6px; background: var(--bg-tertiary); overflow: hidden; }
.rc-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-500), var(--primary-400)); border-radius: 6px; }
.rc-label { margin-top: 22px; font-size: 13px; color: var(--text-tertiary); }
.rc-steps { display: flex; gap: 8px; margin-top: 10px; }
.step { flex: 1; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--bg-tertiary); color: var(--text-tertiary); }
.step.on { background: var(--primary-500); color: #fff; }
.rc-ends { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; font-weight: 600; letter-spacing: 1px; }
.rc-ends span:first-child { color: var(--primary-400); }
.rc-ends span:last-child { color: var(--primary-400); }
.rc-stat { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.rc-stat:first-of-type { margin-top: 8px; }
.rcs-l { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.rcs-v { font-size: 14px; font-weight: 700; color: var(--primary-300); }
.rc-cta { display: flex; width: 100%; margin-top: 18px; padding: 13px; }

/* ---- cta ---- */
.cta { padding: 90px 24px 100px; text-align: center; background: radial-gradient(ellipse at center, rgba(99,102,241,0.06), transparent 60%); }
.cta-foot { margin-top: 22px; font-size: 14px; color: var(--text-tertiary); }
.link { color: var(--primary-400); }
.link:hover { text-decoration: underline; }

/* ---- nav active state ---- */
.nav-links a.active { color: var(--primary-400); position: relative; }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 2px;
  background: var(--primary-500);
  border-radius: 2px;
}

/* ---- challenges page ---- */
.ch-page { position: relative; z-index: 2; max-width: 1280px; margin: 0 auto; padding: 56px 24px 100px; }
.ch-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(48px, 8vw, 76px);
  text-align: center;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #ffffff 25%, #c0c2f3 65%, #6366F1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.ch-sub { margin: 16px auto 0; max-width: 760px; text-align: center; font-size: 18px; line-height: 1.5; color: var(--text-tertiary); }

.ch-controls { display: flex; gap: 14px; margin-top: 46px; }
.ch-search {
  flex: 1;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 18px;
  height: 56px;
}
.ch-search .ico { width: 20px; height: 20px; fill: none; stroke: var(--text-tertiary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ch-search input { flex: 1; background: none; border: none; outline: none; color: #fff; font-family: var(--font-secondary); font-size: 16px; }
.ch-search input::placeholder { color: var(--text-tertiary); }
.ch-search:focus-within { border-color: var(--primary-500); }

.ch-filter {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  height: 56px;
  color: var(--text-secondary);
  font-family: var(--font-secondary);
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: border-color .15s;
}
.ch-filter:hover { border-color: var(--border-light); }
.ch-filter .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-filter .chev-d { stroke: var(--text-tertiary); transition: transform .2s ease; }

/* dropdown */
.ch-dd { position: relative; }
.ch-dd.open .ch-filter { border-color: var(--primary-500); }
.ch-dd.open .chev-d { transform: rotate(180deg); }
.ch-dd.filtered .ch-filter { border-color: var(--primary-500); color: #fff; }
.ch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: #1a1a1c;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  z-index: 40;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.ch-dd.open .ch-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ch-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 11px 14px;
  border-radius: 8px;
  font-family: var(--font-secondary);
  font-size: 15px;
  color: var(--text-secondary);
  transition: background .12s, color .12s;
}
.ch-opt:hover { background: var(--bg-tertiary); color: #fff; }
.ch-opt.active { color: var(--primary-400); font-weight: 500; }
.ch-menu::-webkit-scrollbar { width: 8px; }
.ch-menu::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 8px; }

.ch-accordion { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.ch-cat { background: #141414; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color .15s; }
.ch-cat:hover { border-color: var(--border-light); }
.ch-head {
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  background: none; border: none; cursor: pointer;
  padding: 22px 24px;
  text-align: left;
}
.ch-cat-icon { width: 24px; height: 24px; display: grid; place-items: center; color: var(--primary-400); }
.ch-cat-icon .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-cat-name { font-family: var(--font-primary); font-size: 20px; font-weight: 700; color: #fff; }
.ch-cat-count { font-size: 13px; color: var(--text-tertiary); background: var(--bg-tertiary); border: 1px solid var(--border); padding: 3px 11px; border-radius: 20px; }
.ch-chev { width: 20px; height: 20px; margin-left: auto; fill: none; stroke: var(--text-tertiary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.ch-cat.open .ch-chev { transform: rotate(180deg); }

.ch-body { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.ch-body-inner { padding: 0 24px 20px; display: flex; flex-direction: column; gap: 10px; }
.ch-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  transition: border-color .15s, background .15s;
}
.ch-item:hover { border-color: var(--primary-500); background: var(--bg-tertiary); }
.ci-left { display: flex; flex-direction: column; gap: 4px; }
.ci-name { font-size: 15px; font-weight: 600; color: #fff; }
.ci-by { font-size: 12px; color: var(--text-tertiary); }
.ci-right { display: flex; align-items: center; gap: 14px; }
.ci-diff { font-size: 12px; font-weight: 600; text-transform: capitalize; padding: 4px 12px; border-radius: 20px; border: 1px solid; }
.ci-pts { font-size: 13px; font-weight: 700; color: var(--primary-300); }
.ch-empty { font-size: 14px; color: var(--text-tertiary); padding: 4px 0; }

@media (max-width: 720px) {
  .ch-controls { flex-wrap: wrap; }
  .ch-search { flex-basis: 100%; }
}

/* ---- archives page ---- */
.grad-soft {
  background: linear-gradient(180deg, #a5a7f0 0%, #818CF8 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.arc-stats { display: flex; justify-content: center; gap: 40px; margin-top: 24px; font-size: 15px; color: var(--text-tertiary); }
.arc-stats strong { color: var(--text-secondary); font-weight: 600; }

/* nested category accordions inside a CTF */
.arc-cat-list { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; padding-bottom: 6px; }
.ch-cat.sub { background: var(--bg-secondary); border-color: var(--border); }
.ch-cat.sub .ch-head { padding: 16px 22px; }
.ch-cat.sub .ch-cat-name { font-size: 17px; }
.ch-cat.sub .ch-cat-icon { color: var(--primary-400); }
.ch-cat.sub .ch-body-inner { padding: 0 22px 16px; }

/* challenge cards grid inside a category */
.arc-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding-top: 6px; }
.arc-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: border-color .15s;
}
.arc-card:hover { border-color: var(--primary-500); }
.arc-card-title { font-family: var(--font-primary); font-size: 18px; font-weight: 700; color: #fff; }
.arc-card-desc {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-tertiary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.arc-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.arc-card-badge { font-size: 12px; padding: 4px 12px; border-radius: 8px; background: rgba(99,102,241,0.14); color: var(--primary-300); border: 1px solid rgba(99,102,241,0.25); }
.arc-card-link { font-size: 14px; font-weight: 500; color: var(--primary-400); display: inline-flex; align-items: center; gap: 6px; }
.arc-card-link:hover { color: var(--primary-300); }
.arc-card-link .arr { transition: transform .15s; }
.arc-card-link:hover .arr { transform: translateX(3px); }

@media (max-width: 1000px) { .arc-card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .arc-card-grid { grid-template-columns: 1fr; } }

/* ---- scoreboard page ---- */
.sb-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(48px, 8vw, 76px);
  text-align: center;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #ffffff 25%, #c0c2f3 65%, #6366F1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.sb-sort { transition: all .15s; }
.sb-sort.active { background: var(--primary-500); border-color: var(--primary-500); color: #fff; }
.sb-arrow { width: 16px; height: 16px; }

/* controls wrapped in a padded panel, with a gap before the table */
.sb-controls {
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 28px;
}

.sb-table { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sb-thead, .sb-row {
  display: grid;
  grid-template-columns: 1.1fr 3fr 1.6fr 1.1fr;
  align-items: center;
}
.sb-thead {
  padding: 20px 28px;
  font-size: 15px; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.sb-c-pts { text-align: right; }
.sb-thead .sb-c-pts { text-align: right; }

.sb-row { padding: 18px 28px; border-bottom: 1px solid var(--border); transition: background .15s; }
.sb-row:last-child { border-bottom: none; }
.sb-row:hover { background: rgba(255,255,255,0.02); }

/* rank badge */
.sb-rank {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  font-weight: 700; font-size: 17px;
  color: #1a1a1a;
}
.sb-rank.gold   { background: radial-gradient(circle at 35% 30%, #ffe27a, #f5c518); box-shadow: 0 0 22px rgba(245,197,24,.45); }
.sb-rank.silver { background: radial-gradient(circle at 35% 30%, #ffffff, #cfd2d8); box-shadow: 0 0 22px rgba(207,210,216,.35); }
.sb-rank.bronze { background: radial-gradient(circle at 35% 30%, #f6b066, #e08423); box-shadow: 0 0 22px rgba(224,132,35,.4); }
.sb-rank.blue   { background: var(--primary-500); color: #fff; box-shadow: 0 0 18px rgba(99,102,241,.4); }

/* user */
.sb-c-user { display: flex; align-items: center; gap: 18px; }
.sb-avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none; background: var(--bg-tertiary); display: grid; place-items: center; }
.sb-av-img { width: 100%; height: 100%; object-fit: cover; }
.sb-av-ico { width: 30px; height: 30px; fill: none; stroke: var(--text-tertiary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-user-info { display: flex; flex-direction: column; gap: 5px; }
.sb-user-top { display: flex; align-items: center; gap: 9px; }
.sb-username { font-size: 18px; font-weight: 700; color: #fff; }
.sb-noflag { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--bg-elevated); border: 1px solid var(--border-light); font-size: 12px; font-weight: 600; color: var(--text-tertiary); }
.sb-flag { font-size: 19px; line-height: 1; }
.sb-member { font-size: 14px; color: var(--text-tertiary); }

/* achievements */
.sb-c-ach { display: flex; }
.sb-ach { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; font-weight: 600; font-size: 15px; }
.sb-fire { width: 18px; height: 18px; fill: currentColor; }
.sb-ach-none { color: var(--text-tertiary); }

/* pagination footer */
.sb-footer { margin-top: 28px; text-align: center; }
.sb-showing { font-size: 15px; color: var(--text-tertiary); }
.sb-pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.pg-num, .pg-nav {
  min-width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-family: var(--font-secondary);
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.pg-num:hover, .pg-nav:not([disabled]):hover { border-color: var(--border-light); background: var(--bg-tertiary); }
.pg-num.active { background: var(--primary-500); border-color: var(--primary-500); color: #fff; }
.pg-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-nav[disabled] { opacity: .4; cursor: not-allowed; }
.pg-dots { padding: 0 6px; color: var(--text-tertiary); letter-spacing: 1px; }

/* points */
.sb-c-pts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sb-pts { font-size: 26px; font-weight: 700; color: var(--primary-400); line-height: 1; }
.sb-pts-l { font-size: 13px; color: var(--text-tertiary); }

@media (max-width: 820px) {
  .ch-controls { flex-wrap: wrap; }
  .ch-controls .ch-search { flex-basis: 100%; }
  .sb-thead { display: none; }
  .sb-row { grid-template-columns: auto 1fr auto; gap: 12px; }
  .sb-c-ach { display: none; }
}

/* ---- writeups page ---- */
.wu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 30px; }
.wu-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 22px; transition: border-color .15s; }
.wu-card:hover { border-color: var(--primary-500); }
.wu-card-title { font-family: var(--font-primary); font-size: 18px; font-weight: 700; color: #fff; }
.wu-card-desc { margin-top: 12px; font-size: 14px; line-height: 1.55; color: var(--text-tertiary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wu-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.wu-card-badge { font-size: 12px; padding: 4px 12px; border-radius: 8px; background: rgba(99,102,241,0.14); color: var(--primary-300); border: 1px solid rgba(99,102,241,0.25); }
.wu-card-author { font-size: 13px; color: var(--text-tertiary); }

.wu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 90px 20px 120px;
}
.wu-empty-icon { color: #3a3a3f; margin-bottom: 26px; }
.wu-empty-icon svg { width: 64px; height: 64px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wu-empty-title { font-family: var(--font-primary); font-size: 24px; font-weight: 600; color: var(--text-secondary); }
.wu-empty-sub { margin-top: 10px; font-size: 15px; color: var(--text-tertiary); }

/* ---- machines page ---- */
.mc-page { position: relative; z-index: 2; max-width: 1280px; margin: 0 auto; padding: 56px 24px 100px; }
.mc-title {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: clamp(48px, 8vw, 76px);
  text-align: center;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #ffffff 25%, #c0c2f3 65%, #6366F1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.mc-sub { margin: 16px auto 0; max-width: 820px; text-align: center; font-size: 18px; line-height: 1.5; color: var(--text-tertiary); }

.mc-controls { display: flex; gap: 14px; margin: 46px 0 30px; }

.mc-table { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.mc-thead, .mc-row {
  display: grid;
  grid-template-columns: 2.2fr 1.6fr 1.2fr 0.9fr 0.9fr;
  align-items: center;
}
.mc-thead {
  padding: 16px 28px;
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
}
.mc-c-solves, .mc-c-points, .mc-c-status { text-align: center; }
.mc-thead .mc-c-solves, .mc-thead .mc-c-points, .mc-thead .mc-c-status { text-align: center; }

.mc-row {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.mc-row:last-child { border-bottom: none; }
.mc-row:hover { background: rgba(255,255,255,0.02); }

.mc-c-machine { display: flex; align-items: center; gap: 16px; }
.mc-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 9px; color: var(--text-tertiary); }
.mc-icon .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mc-name { display: flex; flex-direction: column; gap: 3px; }
.mc-n { font-size: 16px; font-weight: 600; color: #fff; }
.mc-by { font-size: 13px; color: var(--text-tertiary); }

.mc-c-diff { display: flex; align-items: center; gap: 10px; }
.mc-diff { font-size: 13px; font-weight: 500; text-transform: capitalize; padding: 4px 14px; border-radius: 20px; border: 1px solid; }
.mc-dot { color: var(--text-tertiary); }
.mc-os { font-size: 13px; color: var(--text-secondary); background: var(--bg-tertiary); border: 1px solid var(--border); padding: 4px 12px; border-radius: 8px; }

.mc-c-solves { display: flex; align-items: center; justify-content: center; gap: 18px; }
.mc-solve { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.ico-sm.blue { stroke: #60A5FA; }
.ico-sm.gold { stroke: none; fill: #EAB308; }

.mc-c-points { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.mc-c-status .mc-dash { color: var(--text-tertiary); font-size: 18px; }
.mc-empty { padding: 40px; text-align: center; color: var(--text-tertiary); font-size: 15px; }

@media (max-width: 820px) {
  .mc-controls { flex-wrap: wrap; }
  .mc-controls .ch-search { flex-basis: 100%; }
  .mc-thead { display: none; }
  .mc-row { grid-template-columns: 1fr 1fr; row-gap: 12px; }
}

/* ---- auth / login ---- */
.nav-links.icons-only a span { display: none; }
.nav-links.icons-only a { gap: 0; }
.nav-links.icons-only { gap: 26px; }
.nav-links.icons-only .ico { width: 22px; height: 22px; }

.auth-wrap {
  position: relative;
  z-index: 5;
  min-height: calc(100vh - 88px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 80px;
}
.auth-card {
  width: 100%;
  max-width: 28rem;            /* max-w-md = 448px */
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;       /* rounded-lg */
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05); /* shadow-sm */
  padding: 1.5rem;             /* p-6 */
}
.auth-title {
  font-family: var(--font-primary);
  font-weight: 800;            /* font-extrabold */
  font-size: 1.875rem;         /* text-3xl */
  line-height: 2.25rem;
  text-align: center;
  letter-spacing: -0.025em;    /* tracking-tight */
  color: #fff;
}
.auth-switch {
  margin-top: 0.25rem;         /* space-y-1 */
  text-align: center;
  font-size: 0.875rem;         /* text-sm */
  color: var(--text-tertiary);
}
.auth-switch .link { color: var(--primary-400); font-weight: 500; }

.field {
  position: relative;
  margin-top: 1rem;
}
.field:first-of-type { margin-top: 1.5rem; }
.field .f-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  fill: none; stroke: var(--text-tertiary);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.field input {
  width: 100%;
  height: 3rem;                /* ~h-12 */
  padding: 0 2.75rem 0 2.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: #fff;
  font-family: var(--font-secondary);
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--text-tertiary); }
.field input:focus { border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.18); }
.field .eye {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary);
  display: grid; place-items: center;
}
.field .eye:hover { color: var(--text-secondary); }
.field .eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.auth-options {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 1.25rem;
}
.remember { display: flex; align-items: center; gap: 0.625rem; cursor: pointer; user-select: none; }
.remember input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox {
  width: 1rem; height: 1rem;
  border: 1px solid var(--border-light);
  border-radius: 0.25rem;
  background: var(--bg-primary);
  display: grid; place-items: center;
  transition: all .15s;
}
.remember input:checked + .checkbox { background: var(--primary-500); border-color: var(--primary-500); }
.checkbox svg { width: 11px; height: 11px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.remember input:checked + .checkbox svg { opacity: 1; }
.remember span { font-size: 0.875rem; color: var(--text-secondary); }

.auth-links { text-align: right; display: flex; flex-direction: column; gap: 0.5rem; }
.auth-links a { font-size: 0.875rem; color: var(--primary-400); }
.auth-links a:hover { text-decoration: underline; }

.agree {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-top: 1.25rem;
  cursor: pointer;
  user-select: none;
}
.agree input { position: absolute; opacity: 0; width: 0; height: 0; }
.agree .checkbox { flex: none; margin-top: 2px; }
.agree input:checked + .checkbox { background: var(--primary-500); border-color: var(--primary-500); }
.agree input:checked + .checkbox svg { opacity: 1; }
.agree-text { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }
.agree-text .link { color: var(--primary-400); }
.agree-text .link:hover { text-decoration: underline; }

.auth-submit {
  width: 100%;
  height: 3rem;
  margin-top: 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
}

@media (max-width: 640px) {
  .auth-options { flex-direction: column; gap: 1rem; }
  .auth-links { text-align: left; }
}

/* ---- footer ---- */
.footer { border-top: 1px solid var(--border); padding: 64px 24px 56px; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px; }
.footer-brand .brand { margin-bottom: 18px; }
.footer-brand > p { font-size: 14px; color: var(--text-tertiary); line-height: 1.6; max-width: 320px; }
.socials { display: flex; gap: 16px; margin-top: 20px; }
.socials a { color: var(--text-tertiary); transition: color .15s; }
.socials a:hover { color: var(--primary-400); }
.socials .ico { width: 20px; height: 20px; }
.footer-col h5 { font-size: 12px; letter-spacing: 1.5px; color: var(--primary-400); margin-bottom: 18px; font-weight: 700; }
.footer-col a { display: block; font-size: 14px; color: var(--text-tertiary); margin-bottom: 12px; transition: color .15s; }
.footer-col a:hover { color: var(--text-primary); }
.footer-col.wide p { font-size: 14px; color: var(--text-tertiary); line-height: 1.55; margin-bottom: 18px; }
.footer-cta { display: flex; width: 100%; padding: 12px; }



.footer-bottom {
  max-width: 1200px;
  margin: 48px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-bottom > span { font-size: 14px; color: var(--text-tertiary); }
.footer-bottom-links { display: flex; gap: 30px; }
.footer-bottom-links a { font-size: 14px; color: var(--text-tertiary); transition: color .15s; }
.footer-bottom-links a:hover { color: var(--text-primary); }

@media (max-width: 1100px) {
  .nav-links { display: none; }
}
@media (max-width: 900px) {
  .os-grid, .feature-grid, .lib-grid, .ranks-grid, .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .section-title.left { text-align: center; }
}
@media (max-width: 640px) {
  .navbar { padding: 18px 20px; }
  .hero-subtitle { font-size: 19px; }
  .hero-buttons { flex-direction: column; width: 100%; max-width: 320px; }
  .btn-lg { width: 100%; }
}

/* Coming-soon hero: .cta fills the viewport (under the navbar), footer pushed below the fold */
.cta {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
