/* ==========================================================================
   SamePursuit · 同道安全
   Design system + components
   Motif: two traces converging into one — 同道
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --bg: #05070d;
  --bg-soft: #080b13;
  --panel: rgba(255, 255, 255, 0.032);
  --panel-2: rgba(255, 255, 255, 0.055);
  --ink: #e9edf7;
  --ink-2: #b9c2d8;
  --muted: #7d88a3;
  --faint: #505a72;

  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);

  --c1: #22d3ee;
  --c2: #818cf8;
  --c3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;

  --grad: linear-gradient(100deg, var(--c1), var(--c2) 52%, var(--c3));
  --grad-soft: linear-gradient(140deg, rgba(34, 211, 238, 0.16), rgba(129, 140, 248, 0.14) 50%, rgba(244, 114, 182, 0.14));

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --shadow: 0 28px 70px -34px rgba(0, 0, 0, 0.9);
  --shadow-glow: 0 0 0 1px var(--line), 0 30px 80px -40px rgba(34, 211, 238, 0.35);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Code", ui-monospace,
    "DejaVu Sans Mono", "Consolas", monospace;

  --wrap: 1180px;
  --nav-h: 68px;
}

/* ---------- reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(129, 140, 248, 0.32);
  color: #fff;
}

/* ---------- ambient background ---------- */
.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aura__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}

.aura__blob--1 {
  width: 52vmax;
  height: 52vmax;
  top: -22vmax;
  left: -14vmax;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.5), transparent 66%);
  animation: drift1 28s ease-in-out infinite;
}

.aura__blob--2 {
  width: 46vmax;
  height: 46vmax;
  top: -8vmax;
  right: -18vmax;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.48), transparent 64%);
  animation: drift2 34s ease-in-out infinite;
}

.aura__blob--3 {
  width: 40vmax;
  height: 40vmax;
  bottom: -22vmax;
  left: 30vmax;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.32), transparent 62%);
  animation: drift3 31s ease-in-out infinite;
}

@keyframes drift1 {
  50% {
    transform: translate3d(7vw, 6vh, 0) scale(1.12);
  }
}

@keyframes drift2 {
  50% {
    transform: translate3d(-8vw, 8vh, 0) scale(0.9);
  }
}

@keyframes drift3 {
  50% {
    transform: translate3d(-6vw, -7vh, 0) scale(1.08);
  }
}

.aura__grid {
  position: absolute;
  inset: -1px;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 80% 58% at 50% 0%, #000 10%, transparent 76%);
  mask-image: radial-gradient(ellipse 80% 58% at 50% 0%, #000 10%, transparent 76%);
}

.aura__noise {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 40px);
}

.wrap--wide {
  max-width: 1320px;
}

.page {
  position: relative;
  z-index: 1;
}

.section {
  padding-block: clamp(46px, 6.5vw, 86px);
  position: relative;
}

.section--tight {
  padding-block: clamp(28px, 4vw, 48px);
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  background: rgba(5, 7, 13, 0.62);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: rgba(5, 7, 13, 0.86);
}

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand__mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__sub {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav__link {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--ink-2);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav__link:hover {
  color: var(--ink);
  background: var(--panel-2);
}

.nav__link[aria-current="page"] {
  color: var(--ink);
}

.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  transform: translateX(-50%);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}

/* mobile toggle */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
  justify-content: center;
}

.burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
  transition: transform 0.24s ease, opacity 0.2s ease;
}

.burger span::before,
.burger span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.24s ease;
}

.burger span::before {
  top: -5px;
}

.burger span::after {
  top: 5px;
}

.burger[aria-expanded="true"] span {
  background: transparent;
}

.burger[aria-expanded="true"] span::before {
  transform: translateY(5px) rotate(45deg);
}

.burger[aria-expanded="true"] span::after {
  transform: translateY(-5px) rotate(-45deg);
}

.sheet {
  display: none;
  border-top: 1px solid var(--line);
  background: rgba(5, 7, 13, 0.97);
}

.sheet.is-open {
  display: block;
}

.sheet ul {
  padding: 10px 0 18px;
}

.sheet a {
  display: block;
  padding: 12px 4px;
  font-size: 1rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.sheet a:last-child {
  border-bottom: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.24s ease, background 0.24s ease,
    border-color 0.24s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  color: #04070e;
  background: var(--grad);
  box-shadow: 0 10px 30px -12px rgba(34, 211, 238, 0.6);
}

.btn--primary:hover {
  box-shadow: 0 16px 40px -14px rgba(129, 140, 248, 0.75);
}

.btn--ghost {
  color: var(--ink);
  border-color: var(--line-2);
  background: var(--panel);
}

.btn--ghost:hover {
  background: var(--panel-2);
  border-color: rgba(255, 255, 255, 0.24);
}

.btn--sm {
  padding: 8px 15px;
  font-size: 0.84rem;
}

.btn--lg {
  padding: 14px 26px;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn .icon {
  width: 1em;
  height: 1em;
  flex: none;
}

/* ---------- type helpers ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse-dot 2.4s ease-out infinite;
}

@keyframes pulse-dot {
  70% {
    box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mono {
  font-family: var(--mono);
}

.muted {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(24px, 4vw, 40px);
  flex-wrap: wrap;
}

.section-head__title {
  margin-top: 10px;
  font-size: clamp(1.5rem, 3.4vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section-head__desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 52ch;
}

.section-head__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.88rem;
  color: var(--ink-2);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.section-head__link:hover {
  color: var(--ink);
  border-color: var(--line-2);
  background: var(--panel);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(48px, 8vw, 92px) clamp(40px, 6vw, 72px);
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

/* grid/flex items must be allowed to shrink below their content width,
   otherwise long nowrap children (buttons, terminal lines) blow the layout out */
.hero__inner > *,
.grid-2 > *,
.bento > *,
.section-head > *,
.footer__grid > * {
  min-width: 0;
}

.hero__kicker {
  margin-bottom: 20px;
}

.hero__title {
  font-size: clamp(2.35rem, 6.2vw, 4.1rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero__title span {
  display: block;
}

.hero__title .hero__line-2 {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.caret {
  display: inline-block;
  width: 0.55ch;
  height: 0.95em;
  margin-left: 0.08em;
  vertical-align: -0.06em;
  background: var(--c1);
  animation: blink 1.15s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero__lead {
  margin-top: 22px;
  max-width: min(46ch, 100%);
  font-size: clamp(0.98rem, 1.5vw, 1.08rem);
  color: var(--ink-2);
}

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

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
}

.hero__meta b {
  color: var(--ink-2);
  font-weight: 600;
}

/* hero visual */
.hero__visual {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: min(520px, 100%);
  margin-inline: auto;
  width: 100%;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__ring {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: spin 34s linear infinite;
}

.hero__ring::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 12px 2px rgba(34, 211, 238, 0.85);
  transform: translateX(-50%);
}

.hero__ring--2 {
  inset: 26%;
  animation-duration: 22s;
  animation-direction: reverse;
  border-color: rgba(255, 255, 255, 0.045);
}

.hero__ring--2::before {
  background: var(--c3);
  box-shadow: 0 0 12px 2px rgba(244, 114, 182, 0.8);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* floating terminal card */
.term {
  position: relative;
  margin: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: rgba(8, 11, 19, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.76rem;
  animation: floaty 7s ease-in-out infinite;
}

@keyframes floaty {
  50% {
    transform: translateY(-9px);
  }
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.term__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
}

.term__dot:nth-child(1) {
  background: #f87171;
}

.term__dot:nth-child(2) {
  background: #fbbf24;
}

.term__dot:nth-child(3) {
  background: #34d399;
}

.term__title {
  margin-left: 6px;
  color: var(--faint);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.term__body {
  padding: 14px 15px 16px;
  display: grid;
  gap: 7px;
  color: var(--ink-2);
  line-height: 1.85;
}

.term__body .ln {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term__prompt {
  color: var(--c1);
}

.term__ok {
  color: var(--ok);
}

.term__key {
  color: var(--c3);
}

.term__body > .term__cursor::after {
  content: "▊";
  margin-left: 2px;
  color: var(--c1);
  animation: blink 1.1s step-end infinite;
}

/* ---------- stat strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--line);
  overflow: hidden;
}

.stat {
  padding: 24px clamp(16px, 2.4vw, 28px);
  background: var(--bg-soft);
}

.stat__num {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat__num i {
  font-style: normal;
  font-size: 0.55em;
  color: var(--muted);
}

.stat__label {
  margin-top: 9px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.bento-card {
  position: relative;
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.28s ease, transform 0.28s ease, background 0.28s ease;
}

.bento-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-soft);
  opacity: 0;
  transition: opacity 0.32s ease;
  pointer-events: none;
}

.bento-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-2);
}

.bento-card:hover::before {
  opacity: 1;
}

.bento-card--wide {
  grid-column: span 3;
}

.bento-card--feature {
  grid-column: span 4;
  min-height: 260px;
}

.bento-card__icon {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--c1);
}

.bento-card__icon svg {
  width: 20px;
  height: 20px;
}

.bento-card__title {
  position: relative;
  margin-top: auto;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.bento-card__desc {
  position: relative;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.65;
}

.bento-card__stat {
  position: relative;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--c1);
}

.bento-card__arrow {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  transition: transform 0.28s ease, color 0.28s ease;
}

.bento-card:hover .bento-card__arrow {
  transform: translate(2px, -2px);
  color: var(--ink);
}

/* stacked avatar row inside bento */
.avatars {
  position: relative;
  display: flex;
  align-items: center;
}

.avatars img,
.avatars .av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--bg-soft);
  margin-left: -9px;
  object-fit: cover;
  background: #111827;
}

.avatars > :first-child {
  margin-left: 0;
}

.avatars__more {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink-2);
  background: var(--panel-2) !important;
}

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.chip--easy {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.32);
  background: rgba(52, 211, 153, 0.1);
}

.chip--medium {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.32);
  background: rgba(251, 191, 36, 0.1);
}

.chip--hard {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.1);
}

.chip--insane {
  color: #d8b4fe;
  border-color: rgba(192, 132, 252, 0.34);
  background: rgba(192, 132, 252, 0.12);
}

.chip--solved {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.14);
}

.chip--live {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.12);
  padding-left: 8px;
}

.chip--live .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse-dot 2.2s ease-out infinite;
}

/* ---------- challenge grid ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.filters__group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.tab:hover {
  color: var(--ink-2);
}

.tab[aria-selected="true"] {
  color: #04070e;
  background: var(--ink);
  font-weight: 600;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  min-width: 200px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.86rem;
  outline: none;
}

.search input::placeholder {
  color: var(--faint);
}

.search svg {
  width: 15px;
  height: 15px;
  color: var(--faint);
  flex: none;
}

.challenges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 16px;
}

.ch-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: left;
  overflow: hidden;
  transition: border-color 0.26s ease, transform 0.26s ease, background 0.26s ease;
}

.ch-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    rgba(129, 140, 248, 0.12),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.ch-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.045);
}

.ch-card:hover::after {
  opacity: 1;
}

.ch-card.is-solved {
  border-color: rgba(52, 211, 153, 0.3);
}

.ch-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ch-card__cat {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c1);
}

.ch-card__title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 6px;
}

.ch-card__desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.62;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ch-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--faint);
}

.ch-card__pts {
  color: var(--ink);
  font-weight: 600;
}

.ch-card__pts i {
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
}

/* skeleton / empty */
.empty {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* ---------- callout ---------- */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(251, 191, 36, 0.24);
  border-radius: var(--r);
  background: rgba(251, 191, 36, 0.075);
  font-size: 0.86rem;
  color: #f6d98a;
  line-height: 1.65;
}

.callout svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
}

.callout code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
}

/* ---------- leaderboard ---------- */
.board {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-soft);
  overflow: hidden;
}

.board__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.board__title {
  font-size: 0.95rem;
  font-weight: 700;
}

.board__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
}

.board__scroll {
  overflow-x: auto;
}

table.ranks {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 620px;
}

table.ranks th {
  padding: 11px 18px;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.ranks td {
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}

table.ranks tr:last-child td {
  border-bottom: 0;
}

table.ranks tbody tr {
  transition: background 0.2s ease;
}

table.ranks tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.rank-no {
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--muted);
  width: 56px;
}

.rank-no--1 {
  color: #fcd34d;
}

.rank-no--2 {
  color: #cbd5e1;
}

.rank-no--3 {
  color: #fdba74;
}

.who {
  display: flex;
  align-items: center;
  gap: 11px;
}

.who__name {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.who__sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: #0f172a;
  border: 1px solid var(--line-2);
}

.tie {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.tie--up {
  color: var(--ok);
}

.tie--down {
  color: var(--bad);
}

.tie--flat {
  color: var(--faint);
}

.bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  min-width: 70px;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* podium */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 22px;
}

.podium__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  text-align: center;
  overflow: hidden;
}

.podium__item::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--grad);
  opacity: 0.7;
}

.podium__item--1 {
  order: 2;
  padding-block: 34px;
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.1), transparent 62%), var(--panel);
}

.podium__item--2 {
  order: 1;
}

.podium__item--3 {
  order: 3;
}

.podium__av {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
}

.podium__item--1 .podium__av {
  width: 66px;
  height: 66px;
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 0 26px -6px rgba(251, 191, 36, 0.6);
}

.podium__name {
  font-weight: 700;
  font-size: 0.98rem;
}

.podium__pts {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--c1);
}

.podium__badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.podium__item--1 .podium__badge {
  color: #fcd34d;
}

/* ---------- marquee / contributor wall ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.marquee + .marquee {
  margin-top: 14px;
}

.marquee__track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: slide-left var(--dur, 52s) linear infinite;
}

.marquee--reverse .marquee__track {
  animation-name: slide-right;
  animation-duration: 62s;
}

.marquee:hover .marquee__track,
.marquee:focus-within .marquee__track {
  animation-play-state: paused;
}

@keyframes slide-left {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes slide-right {
  from {
    transform: translate3d(-50%, 0, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

.quote {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  width: 340px;
  flex: none;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  transition: border-color 0.26s ease, background 0.26s ease;
}

.quote:hover {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.05);
}

.quote__av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  border: 1px solid var(--line-2);
}

.quote__body {
  min-width: 0;
}

.quote__text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote__who {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
}

.quote__who b {
  color: var(--ink-2);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 0.78rem;
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: clamp(48px, 8vw, 96px);
  border-top: 1px solid var(--line);
  padding-block: clamp(36px, 5vw, 56px) 30px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.8fr));
  gap: clamp(24px, 4vw, 52px);
}

.footer__brand {
  max-width: 34ch;
}

.footer__brand p {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
}

.footer__h {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}

.footer__links {
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-2);
}

.footer__links a:hover {
  color: var(--c1);
}

.footer__bottom {
  margin-top: clamp(30px, 4vw, 46px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
}

.modal.is-open {
  display: grid;
}

.modal__veil {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(6px);
  animation: fade-in 0.24s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal__panel {
  position: relative;
  width: min(620px, 100%);
  max-height: min(86svh, 780px);
  overflow-y: auto;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: #080b13;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.95);
  animation: pop-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

.modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 16px;
  background: #080b13;
  border-bottom: 1px solid var(--line);
}

.modal__cat {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c1);
}

.modal__title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.modal__close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.modal__close:hover {
  color: var(--ink);
  border-color: var(--line-2);
}

.modal__body {
  padding: 20px 22px 24px;
  display: grid;
  gap: 18px;
}

.modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal__text {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--ink-2);
}

.modal__text code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
}

.flag-form {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.flag-form label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.flag-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input {
  flex: 1;
  min-width: 180px;
  padding: 11px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.input::placeholder {
  color: var(--faint);
}

.hint-box {
  padding: 12px 14px;
  border-left: 2px solid rgba(129, 140, 248, 0.5);
  background: rgba(129, 140, 248, 0.07);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.84rem;
  color: var(--ink-2);
  line-height: 1.65;
}

.form-msg {
  font-family: var(--mono);
  font-size: 0.76rem;
  min-height: 1.2em;
}

.form-msg--ok {
  color: var(--ok);
}

.form-msg--bad {
  color: var(--bad);
}

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--d, 0ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- page hero (inner pages) ---------- */
.page-head {
  padding-block: clamp(38px, 6vw, 72px) clamp(24px, 3vw, 36px);
}

.page-head__title {
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-top: 14px;
}

.page-head__desc {
  margin-top: 14px;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ---------- prose (about) ---------- */
.prose {
  max-width: 68ch;
  display: grid;
  gap: 18px;
  font-size: 0.98rem;
  color: var(--ink-2);
  line-height: 1.85;
}

.prose h2 {
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -0.015em;
  margin-top: 14px;
}

.prose a {
  color: var(--c1);
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
}

.prose ul {
  display: grid;
  gap: 8px;
  padding-left: 2px;
}

.prose ul li {
  position: relative;
  padding-left: 20px;
}

.prose ul li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--c2);
}

/* ---------- grid helpers ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.card__h {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}

.card__t {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card__d {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.68;
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero__inner {
    grid-template-columns: 1fr;
  }

  .hero__visual {
    max-width: 440px;
  }

  .bento-card--wide,
  .bento-card--feature {
    grid-column: span 3;
  }
}

@media (max-width: 860px) {
  .nav__links {
    display: none;
  }

  .burger {
    display: inline-flex;
  }

  .nav__actions .btn--ghost {
    display: none;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bento-card,
  .bento-card--wide,
  .bento-card--feature {
    grid-column: span 1;
    min-height: auto;
  }

  .bento-card--feature {
    grid-column: span 2;
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer__brand {
    grid-column: 1 / -1;
  }

  .podium {
    grid-template-columns: 1fr;
  }

  .podium__item--1 {
    order: 0;
    padding-block: 26px;
  }

  .search {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand__sub {
    display: none;
  }

  .hero__title {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .btn {
    padding: 10px 17px;
    font-size: 0.88rem;
  }

  .hero__cta .btn {
    flex: 1 1 auto;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stat {
    padding: 18px 16px;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .bento-card--feature {
    grid-column: span 1;
  }

  .quote {
    width: 280px;
  }

  .footer__grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
  }
}

/* ---------- live table flash ---------- */
@keyframes row-flash {
  0% {
    background: rgba(34, 211, 238, 0.16);
  }
  100% {
    background: transparent;
  }
}

table.ranks tbody tr.is-flash {
  animation: row-flash 1.6s ease;
}

/* ---------- contributor wall ---------- */
.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.wall .quote {
  width: auto;
}

.wall .quote__text {
  -webkit-line-clamp: 4;
}

.wall .quote__av {
  width: 42px;
  height: 42px;
}

/* ---------- forms ---------- */
.form-grid {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.form-grid label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 6px;
}

.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  min-height: 84px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.textarea::placeholder {
  color: var(--faint);
}

/* ---------- hero terminal placement ---------- */
.hero__term {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 3;
  width: min(334px, 100%);
  animation: floaty-term 7s ease-in-out infinite;
}

@keyframes floaty-term {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -10px);
  }
}

/* avatars sit at the bottom of a bento card */
.bento-card .avatars {
  margin-top: 12px;
}

/* ---------- narrow screens: keep the columns that matter ---------- */
@media (max-width: 680px) {
  table.ranks {
    min-width: 0;
  }

  /* Drop secondary columns instead of forcing a sideways scroll: on a phone the
     score has to be readable without horizontal scrolling. */
  .col-grade,
  .col-fb,
  .col-trend,
  .col-bar {
    display: none;
  }

  table.ranks th,
  table.ranks td {
    padding-inline: 10px;
  }

  .podium {
    gap: 10px;
  }

  .podium__item {
    padding: 18px 14px;
    gap: 6px;
  }

  .podium__item--1 {
    padding-block: 22px;
  }

  .podium__av {
    width: 46px;
    height: 46px;
  }

  .podium__item--1 .podium__av {
    width: 58px;
    height: 58px;
  }
}

/* ---------- auth button + toast ---------- */
.auth-btn {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-btn.is-in {
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.sp-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(8, 11, 19, 0.95);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.sp-toast.is-in {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal__body select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* ---------- motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .marquee__track {
    animation: none !important;
  }
}
