/* ============================================================
   NEXTGEN CHALLENGE — Design System (v2 · production-grade)
   Refined, real-product aesthetic (Linear/HackerEarth/Devpost).
   Brand from the NextGen X mark: violet · purple · magenta.
   ============================================================ */

:root {
  --brand:     #7c5cf6;
  --brand-2:   #8b6dfb;
  --brand-soft:#a78bfa;
  --violet:    #a855f7;
  --accent:    #ec4899;
  --accent-2:  #f472b6;
  --peach:     #fb923c;

  --bg:        #0a0812;
  --bg-deep:   #080610;
  --surface:   #120e1f;
  --surface-2: #191327;
  --surface-3: #211a33;
  --border:    rgba(255,255,255,0.08);
  --border-2:  rgba(255,255,255,0.14);
  --hairline:  rgba(255,255,255,0.05);

  --text:      #f5f3fb;
  --text-2:    #cbc5df;
  --muted:     #918ca8;
  --muted-2:   #6f6a86;

  --ok:        #34d399;
  --warn:      #fbbf24;
  --bad:       #f87171;

  --grad:      linear-gradient(135deg,#7c5cf6,#a855f7 55%,#ec4899);
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
  --radius:    12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --font: "Inter","Segoe UI",system-ui,-apple-system,sans-serif;
  --font-display: "Space Grotesk","Inter",system-ui,-apple-system,sans-serif;
  --mono: "JetBrains Mono","SFMono-Regular",ui-monospace,monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, textarea, select { font-family: inherit; color: inherit; }

/* ---------- Background ---------- */
.bg-fx {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(1100px 820px at 82% -14%, rgba(124,92,246,0.20), transparent 55%),
    radial-gradient(960px 720px at -12% 16%, rgba(236,72,153,0.12), transparent 52%),
    radial-gradient(1000px 780px at 50% 130%, rgba(255,157,107,0.08), transparent 55%),
    radial-gradient(720px 600px at 12% 88%, rgba(124,58,237,0.12), transparent 55%),
    radial-gradient(500px 400px at 95% 60%, rgba(168,85,247,0.10), transparent 60%),
    var(--bg);
}
.bg-fx::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(168,85,247,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168,85,247,.05) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.9), transparent 78%);
  mask-image: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.9), transparent 78%);
}
.bg-fx::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(4,2,12,.6) 100%);
}
.particles { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

/* Subtle premium film-grain over everything (non-interactive) */
.grain {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  opacity: .045; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 76px 0; }
.section-head { max-width: 660px; margin-bottom: 40px; }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 11.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; background: linear-gradient(90deg,var(--accent),transparent); }
.eyebrow.center { justify-content: center; }
h1,h2,h3,h4 { line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; color: var(--text); font-family: var(--font-display); }
h1 { font-size: clamp(34px,5.5vw,58px); font-weight: 700; }
h2 { font-size: clamp(24px,3.4vw,36px); font-weight: 700; }
h3 { font-size: 19px; }
h4 { font-size: 16px; }
.lead { color: var(--muted); font-size: 16.5px; margin-top: 14px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display);
  font-weight: 600; font-size: 14.5px; border-radius: var(--radius-sm);
  padding: 10px 18px; border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  white-space: nowrap; line-height: 1.2;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(124,92,246,.28); }
.btn-primary:hover { background: var(--brand-2); transform: translateY(-1px); }
.btn-secondary { background: rgba(124,92,246,.12); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover { background: rgba(124,92,246,.20); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.05); color: var(--text); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--bad); border-color: rgba(248,113,113,.25); }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 13px 24px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ---------- Navbar ---------- */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(10,8,18,.82); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.brand .logo-mark { width: 32px; height: 32px; display: grid; place-items: center; }
.brand .logo-mark svg { width: 30px; height: 30px; }
.brand em { font-style: normal; color: var(--brand-soft); font-weight: 600; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  color: var(--muted); font-weight: 500; font-size: 14.5px; padding: 8px 12px; border-radius: 8px;
  transition: color .15s ease, background .15s ease;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-links a.active { color: var(--text); background: rgba(124,92,246,.12); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions .btn { font-weight: 600; }
.nav-actions .user-chip {
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: 4px 10px 4px 4px; border-radius: 999px;
}
.nav-actions .user-chip .av { width: 26px; height: 26px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px; color: var(--text); }
.hamburger svg { width: 20px; height: 20px; }
.drawer { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); display: none; }
.drawer.open { display: block; }
.drawer-panel { position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px; z-index: 121; background: var(--surface); border-right: 1px solid var(--border); padding: 22px; transform: translateX(-100%); transition: transform .25s ease; display: flex; flex-direction: column; gap: 4px; }
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-panel a { color: var(--text-2); font-weight: 600; font-size: 15px; padding: 12px; border-radius: 9px; display: flex; align-items: center; gap: 10px; }
.drawer-panel a:hover { background: rgba(255,255,255,.06); }
.drawer-panel .close { align-self: flex-end; background: none; border: 0; color: var(--text); padding: 6px; }
.drawer-panel .close svg { width: 22px; height: 22px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 76px 0 48px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(40px,6vw,66px); line-height: 1.0; letter-spacing: -0.035em; }
.hero h1 .line { display: block; }
.hero .sub { max-width: 520px; margin-top: 22px; color: var(--muted); font-size: 17px; }
.hero-cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.hero-pill { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px; padding: 7px 14px; border-radius: 999px; background: rgba(124,92,246,.10); border: 1px solid rgba(124,92,246,.28); color: var(--text-2); font-size: 13px; font-weight: 600; }
.hero-pill svg { width: 15px; height: 15px; color: var(--accent); }
.hero-pill b { color: var(--text); font-weight: 700; }
.hero-note { display: flex; gap: 12px; margin-top: 34px; flex-wrap: wrap; }
.hero-note .hn { display: flex; flex-direction: column; min-width: 104px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.hero-note .hn b { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.hero-note .hn span { color: var(--muted); font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase; margin-top: 2px; }

/* Scrolling marquee band — bold editorial accent */
.marquee { overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255,255,255,.015); padding: 16px 0; }
.marquee-track { display: flex; white-space: nowrap; width: max-content; animation: marquee 28s linear infinite; }
.marquee-track span, .marquee-track { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: transparent; -webkit-text-stroke: 1px rgba(167,139,250,.55); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* product panel visual */
.panel { border-radius: var(--radius-lg); border: 1px solid var(--border-2); background: linear-gradient(180deg,var(--surface-2),var(--surface)); box-shadow: var(--shadow-lg); overflow: hidden; }
.panel-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.panel-bar i { width: 10px; height: 10px; border-radius: 50%; }
.panel-bar i.r{background:#f87171} .panel-bar i.y{background:#fbbf24} .panel-bar i.g{background:#34d399}
.panel-bar span { margin-left: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.panel-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mini-card { border: 1px solid var(--border-2); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)); border-radius: var(--radius-sm); padding: 12px 14px; }
.mini-card .mc-top { display: flex; align-items: center; justify-content: space-between; }
.mini-card .mc-top b { font-size: 13.5px; font-family: var(--font-display); }
.mini-card .mc-row { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.mini-card .mc-row span { display: flex; align-items: center; gap: 5px; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-list .row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.02); font-size: 13px; }
.mini-list .row .av { width: 22px; height: 22px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.mini-list .row .sp { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- Cards ---------- */
.card { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)), var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border);
}
.chip svg { width: 13px; height: 13px; }
.chip.cat { background: rgba(124,92,246,.10); color: var(--brand-soft); border-color: rgba(124,92,246,.22); }
.chip.diff-easy, .chip.badge-open { background: rgba(52,211,153,.10); color: var(--ok); border-color: rgba(52,211,153,.25); }
.chip.diff-mid, .chip.badge-ending { background: rgba(251,191,36,.10); color: var(--warn); border-color: rgba(251,191,36,.25); }
.chip.diff-hard, .chip.badge-completed { background: rgba(248,113,113,.10); color: var(--bad); border-color: rgba(248,113,113,.25); }
.chip.neutral { background: rgba(255,255,255,.05); color: var(--text-2); }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Challenge card — content-first (LeetCode/HackerEarth style) */
.chal-card { position: relative; overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.chal-card::before { content:""; position:absolute; top:0; left:0; right:0; height:2px; background: var(--grad); opacity:0; transition: opacity .18s ease; }
.chal-card:hover::before { opacity:1; }
.chal-card:hover { transform: translateY(-4px); border-color: rgba(124,92,246,.42); box-shadow: 0 16px 44px -18px rgba(124,92,246,.55); }
.chal-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.chal-body h3 { font-size: 16.5px; letter-spacing: -0.01em; }
.chal-body h3 a:hover { color: var(--brand-soft); }
.chal-top { display: flex; align-items: center; gap: 10px; }
.chal-icon { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, rgba(124,92,246,.30), rgba(236,72,153,.16)); border: 1px solid rgba(124,92,246,.30); display: grid; place-items: center; color: #cfc2ff; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.chal-icon svg { width: 20px; height: 20px; }

/* DoraHacks-style category cover banner */
.chal-cover { position: relative; height: 96px; display: flex; align-items: center; gap: 12px; padding: 0 18px; overflow: hidden; border-bottom: 1px solid var(--border); }
.chal-cover::after { content:""; position: absolute; inset: 0; background: radial-gradient(120% 160% at 90% -20%, rgba(255,255,255,.16), transparent 50%); }
.chal-cover-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; position: relative; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.chal-cover-ico svg { width: 26px; height: 26px; }
.chal-cover-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; position: relative; letter-spacing: .2px; }
.chal-cover-xp { position: relative; margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.22); padding: 5px 9px; border-radius: 999px; }
.chal-cover-xp svg { width: 11px; height: 11px; }
.chal-cover.cat-ai { background: linear-gradient(135deg,#7c3aed,#a855f7); }
.chal-cover.cat-web-development { background: linear-gradient(135deg,#2563eb,#06b6d4); }
.chal-cover.cat-automation { background: linear-gradient(135deg,#059669,#34d399); }
.chal-cover.cat-design { background: linear-gradient(135deg,#ec4899,#ff9d6b); }
.chal-cover.cat-web3 { background: linear-gradient(135deg,#4f46e5,#a855f7); }
.chal-cover.cat-content-creation { background: linear-gradient(135deg,#d97706,#fb923c); }
.chal-cover.cat-tech { background: linear-gradient(135deg,#475569,#94a3b8); }
.chal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chal-desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.chal-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12.5px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.chal-meta div { display: flex; align-items: center; gap: 5px; }
.chal-meta svg { width: 14px; height: 14px; }
.chal-meta .reward { color: var(--brand-soft); font-weight: 700; }

/* progress */
.prog { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.prog span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

/* ---------- Featured ---------- */
.featured { border-radius: var(--radius-lg); overflow: hidden; position: relative; background: linear-gradient(120deg, rgba(124,92,246,.10), rgba(236,72,153,.06)), var(--surface-2); border: 1px solid var(--border-2); padding: 36px; }
.featured .grid2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: center; }
.feat-stats { display: flex; gap: 30px; margin: 22px 0; flex-wrap: wrap; }
.feat-stats div b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.feat-stats div span { color: var(--muted); font-size: 12.5px; }

/* ---------- Stat cards ---------- */
.stat-card { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.stat-card .ico { width: 34px; height: 34px; border-radius: 8px; background: rgba(124,92,246,.12); display: grid; place-items: center; color: var(--brand-soft); margin-bottom: 10px; }
.stat-card .ico svg { width: 18px; height: 18px; }
.stat-card b { font-size: 26px; letter-spacing: -0.02em; }
.stat-card span { color: var(--muted); font-size: 13px; }

/* ---------- Badges ---------- */
.badge-tile { text-align: center; padding: 18px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .15s ease, border-color .15s ease; }
.badge-tile:hover { transform: translateY(-3px); border-color: var(--border-2); }
.badge-tile .ico { width: 40px; height: 40px; margin: 0 auto 8px; display: grid; place-items: center; color: var(--violet); }
.badge-tile .ico svg { width: 26px; height: 26px; }
.badge-tile h4 { font-size: 13px; }
.badge-tile p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.badge-tile.locked { opacity: .4; filter: grayscale(.8); }

/* ---------- Community ---------- */
.community { text-align: center; border-radius: var(--radius-lg); padding: 56px 30px; background: linear-gradient(180deg, rgba(124,92,246,.10), rgba(236,72,153,.05)), var(--surface-2); border: 1px solid var(--border-2); }
.community .ico-row { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }
.community .ico-row a { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--border); transition: .15s; color: var(--muted); }
.community .ico-row a:hover { background: var(--brand); color: #fff; transform: translateY(-2px); }
.ico-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ico-row a { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--border); transition: .15s; color: var(--muted); }
.ico-row a:hover { background: var(--brand); color: #fff; transform: translateY(-2px); }
.footer .ico-row a { display: grid; place-items: center; }
.ico-row svg { width: 18px; height: 18px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-deep); margin-top: 40px; }
.footer-inner { padding: 56px 24px 28px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; }
.footer h4 { font-size: 13px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); }
.footer a { display: block; color: var(--muted); font-size: 14px; padding: 4px 0; transition: color .15s; }
.footer a:hover { color: var(--text); }
.footer .tag { color: var(--muted); font-size: 14px; margin-top: 12px; max-width: 320px; }
.footer-base { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted-2); font-size: 13px; text-align: center; }

/* ---------- Bottom nav ---------- */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 110; background: rgba(10,8,18,.92); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); font-weight: 600; padding: 5px 0; border-radius: 9px; }
.bottom-nav a svg { width: 19px; height: 19px; }
.bottom-nav a.active { color: var(--brand-soft); }

/* ---------- Page header ---------- */
.page-head { padding: 48px 0 18px; }
.page-head h1 { font-size: clamp(28px,4.5vw,40px); }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 640px; }

/* ---------- Filters / segmented ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0; }
.filters .filter { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 500; font-size: 13.5px; transition: .15s; }
.filters .filter:hover { color: var(--text); border-color: var(--border-2); }
.filters .filter.active { background: var(--brand); color: #fff; border-color: transparent; }

/* Challenge arena — toolbar + search + sort */
.chal-hero { padding: 52px 0 26px; position: relative; }
.chal-hero h1 { font-size: clamp(34px,5vw,54px); }
.chal-hero .sub { max-width: 620px; }
.chal-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 28px; }
.chal-toolbar .search { flex: 1 1 260px; display: flex; align-items: center; gap: 9px; padding: 0 14px; height: 44px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.chal-toolbar .search:focus-within { border-color: rgba(124,92,246,.5); box-shadow: 0 0 0 3px rgba(124,92,246,.15); }
.chal-toolbar .search svg { width: 16px; height: 16px; }
.chal-toolbar .search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.chal-toolbar .search input::placeholder { color: var(--muted-2); }
.chal-toolbar .sort { height: 44px; padding: 0 34px 0 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 13.5px; font-family: var(--font); cursor: pointer; }
.chal-toolbar .sort:hover { border-color: var(--border-2); }
.chal-count { align-self: center; font-size: 12.5px; font-weight: 700; color: var(--brand-soft); padding: 6px 12px; border-radius: 999px; background: rgba(124,92,246,.12); border: 1px solid rgba(124,92,246,.28); white-space: nowrap; }
.seg { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 3px; border-radius: 9px; }
.seg button { background: none; border: 0; padding: 7px 14px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button.active { background: var(--brand); color: #fff; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.tbl td { padding: 14px; border-bottom: 1px solid var(--hairline); font-size: 14px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(124,92,246,.04); }
.rank { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.rank.g1 { background: rgba(251,191,36,.16); color: #fbbf24; }
.rank.g2 { background: rgba(196,187,214,.16); color: #cfc8df; }
.rank.g3 { background: rgba(251,146,60,.16); color: #fb923c; }
.rank.plain { background: rgba(255,255,255,.05); color: var(--muted); }
.user-cell { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; color: #fff; }
img.av { object-fit: cover; }
img.p-av { object-fit: cover; }

/* ---------- Detail ---------- */
.detail-hero { border-radius: var(--radius-lg); padding: 34px; border: 1px solid var(--border-2); margin-bottom: 26px; background: linear-gradient(180deg, rgba(124,92,246,.12), rgba(236,72,153,.06)), var(--surface-2); }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
.detail-side { position: sticky; top: 84px; }
.criteria-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 14px; align-items: center; margin: 12px 0; font-size: 13.5px; }
.criteria-row b { font-weight: 600; }
.criteria-row .prog { height: 7px; }
.criteria-row span { color: var(--muted); }
.list-check { list-style: none; }
.list-check li { padding: 7px 0 7px 26px; position: relative; color: var(--text-2); font-size: 14.5px; }
.list-check li::before { content: ""; position: absolute; left: 0; top: 12px; width: 16px; height: 16px; border-radius: 5px; background: rgba(52,211,153,.14); }
.list-check li::after { content: ""; position: absolute; left: 4px; top: 14px; width: 8px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.list-check.rules li::before { background: rgba(124,92,246,.14); }
.list-check.rules li::after { background: none; border: none; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-soft); left: 5px; top: 16px; transform: none; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 22px; }
.box h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 9px; }
.box h3 .ico svg { width: 18px; height: 18px; color: var(--brand-soft); }

/* ---------- Profile ---------- */
.profile-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding: 34px; border-radius: var(--radius-lg); background: linear-gradient(180deg, rgba(124,92,246,.10), rgba(236,72,153,.04)), var(--surface-2); border: 1px solid var(--border-2); margin-bottom: 24px; }
.p-av { width: 80px; height: 80px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; font-weight: 900; color: #fff; }
.profile-hero h1 { font-size: 28px; }
.profile-hero .handle { color: var(--muted); }
.profile-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 24px; }

/* ---------- Dashboard ---------- */
.dash-layout { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; padding-top: 30px; }
.dash-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.dash-side .dnav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; transition: .13s; }
.dash-side .dnav svg { width: 17px; height: 17px; }
.dash-side .dnav:hover { background: rgba(255,255,255,.05); color: var(--text); }
.dash-side .dnav.active { background: rgba(124,92,246,.12); color: var(--text); }
.dash-side .dnav.active svg { color: var(--brand-soft); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; align-items: start; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.xpbar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.xpbar span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

/* ---------- Activity ---------- */
.activity { display: flex; flex-direction: column; }
.activity .item { display: flex; gap: 12px; padding: 12px 2px; align-items: flex-start; border-bottom: 1px solid var(--hairline); }
.activity .item:last-child { border-bottom: 0; }
.activity .item .ico { width: 32px; height: 32px; border-radius: 9px; background: rgba(124,92,246,.10); display: grid; place-items: center; color: var(--brand-soft); flex-shrink: 0; }
.activity .item .ico svg { width: 16px; height: 16px; }
.activity .item p { font-size: 13.5px; }
.activity .item span { color: var(--muted); font-size: 12px; }

/* ---------- Project card ---------- */
.proj-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .16s, border-color .16s; }
.proj-card:hover { transform: translateY(-3px); border-color: var(--border-2); }
.proj-thumb { height: 150px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(124,92,246,.20), rgba(236,72,153,.10)); border-bottom: 1px solid var(--border); color: rgba(255,255,255,.85); }
.proj-thumb svg { width: 44px; height: 44px; }
.proj-body { padding: 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.proj-body h3 { font-size: 15.5px; }
.proj-creator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.proj-actions { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--hairline); padding-top: 10px; }
.proj-actions div { display: flex; align-items: center; gap: 5px; }
.proj-actions svg { width: 14px; height: 14px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 88vh; display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-card .logo-row { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-card .logo-row svg { width: 40px; height: 40px; }
.auth-card h1 { text-align: center; font-size: 22px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 24px; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); font-size: 13.5px; }
.auth-alt a { color: var(--brand-soft); font-weight: 600; }

/* ---------- Forms ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field .hint { color: var(--muted-2); font-size: 12px; margin-top: 5px; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-deep); font-size: 14.5px; transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,92,246,.18); }
textarea.input { resize: vertical; min-height: 90px; }
select.input option { background: var(--surface-2); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 340px; padding: 12px 15px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: slideIn .22s ease; }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--bad); }
.toast .tico { font-size: 17px; }
.toast b { font-size: 13.5px; display: block; }
.toast p { color: var(--muted); font-size: 12.5px; }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Loading / empty ---------- */
.loader { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; margin: 0 auto 12px; display: grid; place-items: center; opacity: .6; }
.empty .ico svg { width: 34px; height: 34px; }

/* ---------- Loading screen ---------- */
.loader-screen { position: fixed; inset: 0; z-index: 999; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 3vh; background: var(--bg); overflow: hidden; transition: opacity .6s ease, transform .6s ease; opacity: 1; }
.loader-screen.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-bg { position: absolute; inset: 0; z-index: 0; animation: bgFade 1.4s ease both; }
.loader-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; filter: blur(16px); transform: scale(1.15); animation: bgFade 1.4s ease both, bgZoom 16s ease-in-out infinite; }
@keyframes bgFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes bgZoom { 0%,100% { transform: scale(1.15) } 50% { transform: scale(1.24) } }
.loader-overlay { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(7,3,15,.85) 0%, rgba(7,3,15,.3) 42%, rgba(7,3,15,.14) 58%, rgba(7,3,15,.97) 100%); }
.loader-vignette { position: absolute; inset: 0; z-index: 2; box-shadow: inset 0 0 200px 40px rgba(7,3,15,.85); }
.loader-wrap { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.loader-ring { position: relative; width: 128px; height: 128px; }
.loader-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(168,85,247,.18); stroke-width: 3; }
.ring-fill { fill: none; stroke: url(#ngGrad); stroke-width: 3.6; stroke-linecap: round; stroke-dasharray: 340; stroke-dashoffset: 340; }
.loader-progress { display: flex; flex-direction: column; align-items: center; margin-top: 22px; width: 240px; }
.loader-percent { font-size: 30px; font-weight: 800; letter-spacing: 1px; color: #fff; line-height: 1; opacity: 0; animation: fadeIn .5s ease .2s both; }
.loader-status { margin-top: 8px; font-size: 11.5px; letter-spacing: 2px; color: var(--muted); font-weight: 600; opacity: 0; animation: fadeIn .5s ease .3s both; }
.loader-track { margin-top: 14px; width: 100%; height: 5px; border-radius: 99px; background: rgba(168,85,247,.14); overflow: hidden; }
.loader-bar { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg,#7c3aed,#a855f7,#ff4fd8); box-shadow: 0 0 14px rgba(255,79,216,.7); }
@keyframes fillRing { to { stroke-dashoffset: 0; } }
.loader-logo { position: absolute; inset: 0; display: grid; place-items: center; }
.loader-logo img { width: 58px; height: 58px; animation: splashIn .7s cubic-bezier(.2,.8,.3,1.15) both; }
.loader-word { margin-top: 20px; letter-spacing: 6px; color: #fff; font-size: 15px; font-weight: 700; font-family: var(--font-display); opacity: 0; animation: wordIn .9s ease .35s both; text-shadow: 0 0 26px rgba(168,85,247,.65); }
.loader-tag { margin-top: 10px; letter-spacing: 4px; color: var(--muted); font-size: 10.5px; font-weight: 600; font-family: var(--font-display); opacity: 0; animation: fadeIn 1s ease .6s both; }
@keyframes wordIn { from { opacity: 0; letter-spacing: 16px; } to { opacity: 1; letter-spacing: 6px; } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes splashIn { from { opacity: 0; transform: scale(.2) rotate(-8deg); } to { opacity: 1; transform: scale(1) rotate(0); } }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Tabs (admin) ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs .tab { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13.5px; }
.tabs .tab.active { background: var(--brand); color: #fff; border-color: transparent; }
.admin-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .dash-layout { grid-template-columns: 1fr; }
  .dash-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .featured .grid2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .hamburger { display: inline-flex; }
  .nav-actions .btn { display: none; }
  .nav-actions .user-chip { display: none; }
  .bottom-nav { display: flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .footer-inner { grid-template-columns: 1fr; gap: 26px; }
  .footer { padding-bottom: 84px; }
  .profile-stats, .admin-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 48px 0 30px; }
  .toast-wrap { left: 20px; right: 20px; }
  .toast { max-width: none; }
  .featured { padding: 24px 18px; }
  .panel { display: none; }
}
@media (min-width: 721px) { .container { padding: 0 32px; } .footer-inner { padding: 56px 32px 28px; } }

/* ---------- Live Contest ---------- */
.contest-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 20px;
  background: linear-gradient(160deg, rgba(124,58,237,.12), rgba(20,10,43,.7) 45%, rgba(255,79,216,.08));
  padding: 34px 34px 36px; box-shadow: 0 24px 70px -30px rgba(124,58,237,.45);
}
.contest-card::before { content:""; position:absolute; inset:-40% -20% auto; height:220px;
  background: radial-gradient(circle at 20% 0%, rgba(168,85,247,.25), transparent 60%); pointer-events:none; }
.contest-head { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; position:relative; }
.contest-days { font-weight:800; font-size:15px; letter-spacing:.3px; color:var(--text); position:relative; }
.contest-days::before { content:"·"; color:var(--accent); margin-right:6px; }
.contest-title { font-size: clamp(24px, 4vw, 38px); line-height:1.15; margin-top:18px; position:relative; }
.contest-sub { color:var(--muted); margin-top:10px; max-width:640px; position:relative; }
.contest-count { display:flex; gap:12px; flex-wrap:wrap; margin:24px 0; position:relative; }
.contest-count div { flex:1; min-width:72px; text-align:center; padding:14px 8px;
  background: rgba(255,255,255,.03); border:1px solid var(--border); border-radius:14px; }
.contest-count b { display:block; font-size:28px; font-weight:800;
  background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent; font-variant-numeric:tabular-nums; }
.contest-count span { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:1px; }
.contest-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; position:relative; }
.contest-grid .box { padding:22px; }
.contest-grid h3 { margin-bottom:14px; }
.prize-list { list-style:none; display:flex; flex-direction:column; gap:10px; }
.prize-list li { display:flex; align-items:center; gap:12px; font-size:14px; color:var(--text-2); flex-wrap:wrap; }
.prize-list li > span:nth-child(2) { flex:1 1 auto; min-width:0; }
.prize-list li em { margin-left:auto; color:var(--accent); font-style:normal; font-weight:600; font-size:12px; flex:none; }
.prize-list li.others { color:var(--muted); }
.prize-medal { width:26px; height:26px; border-radius:8px; display:grid; place-items:center; font-weight:800; font-size:13px; flex:none;
  background: linear-gradient(135deg,#f59e0b,#ffd166); color:#1a1205; }
.prize-list li:nth-child(2) .prize-medal { background:linear-gradient(135deg,#cbd5e1,#e2e8f0); color:#0f172a; }
.prize-list li:nth-child(3) .prize-medal { background:linear-gradient(135deg,#d97706,#b45309); color:#fff; }
.steps { list-style:none; counter-reset:st; display:flex; flex-direction:column; gap:12px; }
.steps li { counter-increment:st; display:flex; flex-wrap:wrap; gap:6px 12px; font-size:14px; color:var(--text-2); position:relative; padding-left:34px; }
.steps li::before { content:counter(st); position:absolute; left:0; top:0; width:22px; height:22px; border-radius:50%;
  background:var(--grad); color:#fff; font-size:12px; font-weight:700; display:grid; place-items:center; }
.steps code { color:var(--accent); background:rgba(255,79,216,.08); padding:3px 8px; border-radius:6px; display:inline-block; max-width:100%; overflow-wrap:anywhere; white-space:normal; }
.note { margin-top:14px; font-size:12.5px; color:var(--muted); }
.contest-cta { display:flex; gap:12px; flex-wrap:wrap; margin-top:26px; position:relative; }
.contest-foot { margin-top:18px; font-size:12px; color:var(--muted); position:relative; }
@media (max-width: 720px){ .contest-grid { grid-template-columns:1fr; } .contest-card { padding:26px 20px; } }