/*
 * CyberRank Design System
 * Premium national cybersecurity ranking platform
 * Deep navy · Soft purple/blue · Rounded · Clean
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ════════════════════════════════════════════════════
   DESIGN TOKENS
════════════════════════════════════════════════════ */
:root {
  /* ── Base Colors ── */
  --base:           #0B0F1A;
  --surface:        #111827;
  --surface-2:      #1C2333;
  --surface-3:      #242D40;
  --surface-4:      #2D3855;
  --border:         rgba(255,255,255,0.06);
  --border-2:       rgba(255,255,255,0.10);
  --border-3:       rgba(255,255,255,0.16);

  /* ── Text ── */
  --text:           #E2E8F7;
  --text-muted:     #8B9ABB;
  --text-subtle:    #4B5A7E;

  /* ── Primary — Indigo/Purple ── */
  --primary:        #6366F1;
  --primary-hover:  #5558E8;
  --primary-active: #4A4DDE;
  --primary-soft:   rgba(99,102,241,0.12);
  --primary-glow:   0 0 28px rgba(99,102,241,0.20);

  /* ── Accent — Teal/Cyan for rankings ── */
  --accent:         #10D9B4;
  --accent-hover:   #0EC4A3;
  --accent-soft:    rgba(16,217,180,0.10);
  --accent-glow:    0 0 24px rgba(16,217,180,0.15);

  /* ── Semantic ── */
  --success:        #22C55E;
  --success-soft:   rgba(34,197,94,0.10);
  --warning:        #F59E0B;
  --warning-soft:   rgba(245,158,11,0.10);
  --danger:         #EF4444;
  --danger-soft:    rgba(239,68,68,0.10);
  --info:           #60A5FA;
  --info-soft:      rgba(96,165,250,0.10);

  /* ── CTF Category Colors ── */
  --cat-web:        #60A5FA;   --cat-web-soft:      rgba(96,165,250,0.12);
  --cat-crypto:     #A78BFA;   --cat-crypto-soft:   rgba(167,139,250,0.12);
  --cat-pwn:        #F87171;   --cat-pwn-soft:      rgba(248,113,113,0.12);
  --cat-osint:      #34D399;   --cat-osint-soft:    rgba(52,211,153,0.12);
  --cat-misc:       #FBBF24;   --cat-misc-soft:     rgba(251,191,36,0.12);
  --cat-forensics:  #FB923C;   --cat-forensics-soft:rgba(251,146,60,0.12);

  /* ── Difficulty ── */
  --easy:   var(--success);  --easy-soft:   var(--success-soft);
  --medium: var(--warning);  --medium-soft: var(--warning-soft);
  --hard:   var(--danger);   --hard-soft:   var(--danger-soft);
  --insane: #A78BFA;         --insane-soft: rgba(167,139,250,0.12);

  /* ── Special ── */
  --gold:         #F59E0B;
  --gold-soft:    rgba(245,158,11,0.12);
  --silver:       #9CA3AF;
  --bronze:       #D97706;
  --blood:        #F43F5E;
  --blood-soft:   rgba(244,63,94,0.12);

  /* ── Gradients ── */
  --gradient-primary:  linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --gradient-accent:   linear-gradient(135deg, #10D9B4 0%, #6366F1 100%);
  --gradient-hero:     linear-gradient(160deg, #0B0F1A 0%, #111827 50%, #0d1430 100%);
  --gradient-card:     linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(139,92,246,0.04) 100%);
  --gradient-rank:     linear-gradient(135deg, #10D9B4 0%, #6366F1 100%);

  /* ── Radius ── */
  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs:  0 1px 3px rgba(0,0,0,0.25);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.25);

  /* ── Layout ── */
  --sidebar-w:   248px;
  --topbar-h:    64px;
  --content-max: 1280px;

  /* ── Typography ── */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ── Motion ── */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-sm: 0.15s;
  --duration-md: 0.2s;
  --duration-lg: 0.3s;
}


/* ════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.ds {
  background: var(--base);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; }
ul { list-style: none; }
input, textarea, select { font: inherit; }


/* ════════════════════════════════════════════════════
   TYPOGRAPHY
════════════════════════════════════════════════════ */
.ds-h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.ds-h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
.ds-h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 600; line-height: 1.3; }
.ds-h4 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.ds-body { font-size: 0.9375rem; line-height: 1.7; }
.ds-small { font-size: 0.8125rem; line-height: 1.5; }
.ds-mono { font-family: var(--font-mono); font-size: 0.8125rem; }

.ds-text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ds-text-accent-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ds-text-muted { color: var(--text-muted); }
.ds-text-subtle { color: var(--text-subtle); }


/* ════════════════════════════════════════════════════
   PUBLIC LAYOUT SYSTEM
════════════════════════════════════════════════════ */

/* ─── Public Navbar ─── */
.pub-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  transition: background var(--duration-md) var(--ease),
              box-shadow var(--duration-md) var(--ease),
              backdrop-filter var(--duration-md) var(--ease);
}
.pub-nav.scrolled {
  background: rgba(11,15,26,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--border), var(--shadow-md);
}
.pub-nav__inner {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.pub-nav__logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.pub-nav__wordmark {
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 3.2vw, 1.7rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}
.pub-nav__wordmark-cyber {
  color: #e9f0ff;
  text-shadow:
    0 0 8px rgba(233, 240, 255, 0.72),
    0 0 18px rgba(214, 228, 255, 0.56),
    0 0 30px rgba(171, 190, 235, 0.42);
}
.pub-nav__wordmark-rank {
  margin-left: 0.34em;
  background: linear-gradient(90deg, #667eff 0%, #3cb4ff 55%, #22e0cf 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 10px rgba(103, 124, 255, 0.55),
    0 0 24px rgba(48, 177, 255, 0.45),
    0 0 34px rgba(30, 230, 201, 0.35);
}
.pub-nav__logo-icon {
  width: 28px; height: 28px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: white; font-weight: 800;
}
.pub-nav__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.pub-nav__link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-sm) var(--ease), background var(--duration-sm) var(--ease);
}
.pub-nav__link:hover { color: var(--text); background: var(--surface-2); }
.pub-nav__link.active { color: var(--text); }
.pub-nav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}
.pub-nav__hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--duration-sm), background var(--duration-sm);
  margin-left: auto;
}
.pub-nav__hamburger:hover { color: var(--text); background: var(--surface-2); }
.pub-nav__mobile {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: rgba(17,24,39,0.97);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  z-index: 99;
  flex-direction: column;
  gap: 0.25rem;
}
.pub-nav__mobile-link {
  display: block;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: color var(--duration-sm), background var(--duration-sm);
}
.pub-nav__mobile-link:hover { color: var(--text); background: var(--surface-2); }

/* ─── Public Footer ─── */
.pub-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem 2rem;
}
.pub-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}
.pub-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.pub-footer__brand p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  max-width: 240px;
  line-height: 1.6;
}
.pub-footer__col-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
}
.pub-footer__col-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pub-footer__col-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--duration-sm);
}
.pub-footer__col-links a:hover { color: var(--text); }
.pub-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-subtle);
}


/* ════════════════════════════════════════════════════
   APP LAYOUT SYSTEM (Dashboard)
════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--base);
}

/* ─── Sidebar ─── */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform var(--duration-lg) var(--ease);
}
.app-sidebar__logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.app-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.app-sidebar__nav::-webkit-scrollbar { width: 4px; }
.app-sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.app-sidebar__nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--radius-full); }

.sidebar-section {
  margin-bottom: 0.5rem;
}
.sidebar-section__label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0.625rem;
  margin-bottom: 0.375rem;
  margin-top: 0.75rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-sm) var(--ease),
              background var(--duration-sm) var(--ease);
}
.sidebar-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar-link.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.sidebar-link.active .sidebar-link__icon { color: var(--primary); }
.sidebar-link__icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active .sidebar-link__icon { opacity: 1; }
.sidebar-link__badge {
  margin-left: auto;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.125rem 0.4rem;
  border-radius: var(--radius-full);
}

.app-sidebar__user {
  padding: 0.875rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.375rem;
  border-radius: var(--radius-md);
  transition: background var(--duration-sm);
}
.sidebar-user-card:hover { background: var(--surface-2); }
.sidebar-user-card__info { flex: 1; min-width: 0; }
.sidebar-user-card__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-card__role {
  font-size: 0.6875rem;
  color: var(--text-subtle);
}

/* ─── Topbar ─── */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(11,15,26,0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}
.app-topbar__search {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.app-topbar__search-input {
  width: 100%;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0 1rem 0 2.5rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--duration-sm), box-shadow var(--duration-sm);
}
.app-topbar__search-input::placeholder { color: var(--text-subtle); }
.app-topbar__search-input:focus {
  border-color: var(--border-2);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.app-topbar__search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}
.app-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: color var(--duration-sm), background var(--duration-sm), border-color var(--duration-sm);
}
.topbar-icon-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }
.topbar-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--danger);
  border: 2px solid var(--surface);
  border-radius: var(--radius-full);
  font-size: 0.5625rem;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem 0.25rem 0.25rem;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color var(--duration-sm), background var(--duration-sm);
  cursor: pointer;
}
.topbar-user:hover { border-color: var(--border-2); background: var(--surface-3); }

/* ─── App Content ─── */
.app-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.app-content--wide {
  max-width: none;
}

/* ─── Page Header ─── */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--primary);
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}
.page-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.page-header__sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ─── Dashboard Grid ─── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.col-span-12 { grid-column: span 12; }
.col-span-8  { grid-column: span 8; }
.col-span-7  { grid-column: span 7; }
.col-span-6  { grid-column: span 6; }
.col-span-5  { grid-column: span 5; }
.col-span-4  { grid-column: span 4; }
.col-span-3  { grid-column: span 3; }

/* Dropdown */
.ds-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 200;
}
.ds-dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color var(--duration-sm), background var(--duration-sm);
  cursor: pointer;
}
.ds-dropdown__item:hover { color: var(--text); background: var(--surface-3); }


/* Notification dropdown content (bell popup) */
.ds-dropdown .notif-dropdown__header {
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border-2);
  background: rgba(99,102,241,0.08);
}

.ds-dropdown .notif-dropdown__list {
  padding: 0.28rem 0;
}

.ds-dropdown .notif-item {
  margin: 0.28rem 0.55rem;
  padding: 0.75rem 0.82rem;
  border: 1px solid transparent;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  column-gap: 0.62rem;
  align-items: start;
}

.ds-dropdown .notif-item:hover {
  background: rgba(148,163,184,0.08);
  border-color: var(--border-3);
}

.ds-dropdown .notif-item--unread {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.32);
}

.ds-dropdown .notif-item__icon-wrap {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-2);
  background: var(--surface-3);
}

.ds-dropdown .notif-item__icon {
  font-size: 0.78rem;
  line-height: 1;
}

.ds-dropdown .notif-item__text {
  min-width: 0;
}

.ds-dropdown .notif-item__text p {
  margin: 0;
  line-height: 1.42;
  color: var(--text);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ds-dropdown .notif-item__time {
  margin-top: 0.3rem !important;
  color: var(--text-muted) !important;
  font-size: 0.74rem !important;
  font-family: var(--font-mono);
}

.ds-dropdown .notif-dropdown__footer {
  padding: 0.72rem 0.9rem 0.9rem;
  border-top: 1px solid var(--border-2);
  display: flex;
  justify-content: center;
}

.ds-dropdown .notif-dropdown__empty {
  padding: 1.1rem 1rem 1.2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
}
.ds-dropdown__item--danger:hover { color: var(--danger); }
.ds-dropdown__sep { height: 1px; background: var(--border); margin: 0.25rem 0; }
.ds-dropdown__header {
  padding: 0.625rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}


/* ════════════════════════════════════════════════════
   COMPONENT LIBRARY
════════════════════════════════════════════════════ */

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--duration-sm) var(--ease);
  text-decoration: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--primary-soft); }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-sm), var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 32px rgba(99,102,241,0.3);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-2); }

.btn-accent {
  background: var(--accent);
  color: #0B0F1A;
  font-weight: 700;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: var(--shadow-md), var(--accent-glow); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.9375rem; }
.btn-xl { padding: 0.875rem 2.25rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-md); }
.btn-icon-lg { padding: 0.625rem; border-radius: var(--radius-lg); }

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  transition: border-color var(--duration-md) var(--ease),
              box-shadow var(--duration-md) var(--ease),
              transform var(--duration-md) var(--ease);
}
.card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
.card--elevated {
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}
.card--primary {
  background: var(--primary-soft);
  border-color: rgba(99,102,241,0.2);
}
.card--accent {
  background: var(--accent-soft);
  border-color: rgba(16,217,180,0.2);
}
.card--interactive {
  cursor: pointer;
}
.card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}
.card__subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ─── Stat Cards ─── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}
.stat-card__icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.875rem;
  flex-shrink: 0;
}
.stat-card__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.stat-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card__delta {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.375rem;
  display: flex; align-items: center; gap: 0.25rem;
}
.stat-card__delta--up { color: var(--success); }
.stat-card__delta--down { color: var(--danger); }
.stat-card__glow {
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-primary   { background: var(--primary-soft); color: var(--primary); }
.badge-accent    { background: var(--accent-soft); color: var(--accent); }
.badge-success   { background: var(--success-soft); color: var(--success); }
.badge-warning   { background: var(--warning-soft); color: var(--warning); }
.badge-danger    { background: var(--danger-soft); color: var(--danger); }
.badge-info      { background: var(--info-soft); color: var(--info); }
.badge-muted     { background: var(--surface-3); color: var(--text-muted); }

/* CTF category badges */
.badge-web       { background: var(--cat-web-soft); color: var(--cat-web); }
.badge-crypto    { background: var(--cat-crypto-soft); color: var(--cat-crypto); }
.badge-pwn       { background: var(--cat-pwn-soft); color: var(--cat-pwn); }
.badge-osint     { background: var(--cat-osint-soft); color: var(--cat-osint); }
.badge-misc      { background: var(--cat-misc-soft); color: var(--cat-misc); }
.badge-forensics { background: var(--cat-forensics-soft); color: var(--cat-forensics); }

/* Difficulty badges */
.badge-easy   { background: var(--easy-soft); color: var(--easy); }
.badge-medium { background: var(--medium-soft); color: var(--medium); }
.badge-hard   { background: var(--hard-soft); color: var(--hard); }
.badge-insane { background: var(--insane-soft); color: var(--insane); }

/* ─── Avatar ─── */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 48px; height: 48px; }
.avatar-xl  { width: 64px; height: 64px; }
.avatar-2xl { width: 80px; height: 80px; }

.avatar-ring {
  border: 2px solid transparent;
  background: var(--gradient-rank) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
}

/* ─── Progress bars ─── */
.progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  transition: width 0.6s var(--ease);
}
.progress--accent .progress__bar { background: var(--gradient-accent); }
.progress--success .progress__bar { background: var(--success); }
.progress--sm { height: 4px; }
.progress--lg { height: 8px; }

/* ─── Input ─── */
.ds-input {
  width: 100%;
  height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.875rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--duration-sm), box-shadow var(--duration-sm);
}
.ds-input::placeholder { color: var(--text-subtle); }
.ds-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ds-input:hover:not(:focus) { border-color: var(--border-2); }
.ds-input--lg { height: 48px; font-size: 0.9375rem; padding: 0 1rem; border-radius: var(--radius-lg); }

.ds-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--duration-sm), box-shadow var(--duration-sm);
}
.ds-textarea::placeholder { color: var(--text-subtle); }
.ds-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.ds-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state__icon {
  width: 56px; height: 56px;
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}
.empty-state__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}
.empty-state__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* ─── Skeleton Loading ─── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 37%,
    var(--surface-2) 63%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text  { height: 14px; width: 100%; }
.skeleton-title { height: 24px; width: 60%; }
.skeleton-avatar { border-radius: var(--radius-full); }

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 340px;
  animation: toastIn 0.3s var(--ease-bounce);
}
@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.toast__icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error   .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--info    .toast__icon { background: var(--info-soft); color: var(--info); }
.toast--warning .toast__icon { background: var(--warning-soft); color: var(--warning); }
.toast__title { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.toast__desc  { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,15,26,0.8);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: modalIn 0.25s var(--ease);
}
@keyframes modalIn {
  from { transform: scale(0.95) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal__header {
  padding: 1.5rem 1.5rem 0;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.modal__title { font-size: 1.125rem; font-weight: 700; color: var(--text); }
.modal__body  { padding: 1rem 1.5rem 1.5rem; }
.modal__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
}

/* ─── Table ─── */
.ds-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.ds-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ds-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.ds-table tr:last-child td { border-bottom: none; }
.ds-table tbody tr {
  transition: background var(--duration-sm);
}
.ds-table tbody tr:hover { background: var(--surface-2); }

/* ─── Alert/Flash messages ─── */
.ds-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}
.ds-alert--success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.ds-alert--error   { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.ds-alert--warning { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.ds-alert--info    { background: var(--info-soft); color: var(--info); border: 1px solid rgba(96,165,250,0.2); }

/* Flash message container */
.flash-container {
  position: fixed;
  top: calc(var(--topbar-h) + 0.75rem);
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
}


/* ════════════════════════════════════════════════════
   PUBLIC PAGE COMPONENTS
════════════════════════════════════════════════════ */

/* ─── Section wrapper ─── */
.pub-section {
  padding: 5rem 2rem;
}
.pub-section--alt {
  background: rgba(17,24,39,0.5);
}
.pub-section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}
.pub-section__header {
  text-align: center;
  margin-bottom: 3.5rem;
}
.pub-section__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.pub-section__title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.875rem;
}
.pub-section__sub {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── Feature Cards ─── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 1.75rem;
  transition: transform var(--duration-md) var(--ease),
              border-color var(--duration-md) var(--ease),
              box-shadow var(--duration-md) var(--ease);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-lg);
}
.feature-card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.125rem;
}
.feature-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.feature-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Steps ─── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
}
.steps-grid::before {
  content: '';
  position: absolute;
  top: 28px; left: calc(16.666% + 24px); right: calc(16.666% + 24px);
  height: 1px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  opacity: 0.3;
}
.step-card {
  text-align: center;
  padding: 1.5rem;
}
.step-card__num {
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: var(--primary-glow);
}
.step-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.step-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Live Preview Cards ─── */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}
.preview-card__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.preview-card__body { padding: 0.75rem; }

/* ─── FAQ ─── */
.faq-list { display: flex; flex-direction: column; gap: 0.75rem; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--duration-sm);
}
.faq-item:hover { border-color: var(--border-2); }
.faq-item[open] { border-color: rgba(99,102,241,0.3); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item__icon { flex-shrink: 0; transition: transform var(--duration-md); color: var(--text-muted); }
.faq-item[open] .faq-item__icon { transform: rotate(45deg); color: var(--primary); }
.faq-item__body {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── CTA Section ─── */
.pub-cta {
  background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(16,217,180,0.06) 100%);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-2xl);
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.pub-cta::before {
  content: '';
  position: absolute;
  top: -80px; left: 50%; transform: translateX(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* ─── University Grid ─── */
.uni-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.uni-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  text-align: center;
  transition: transform var(--duration-md), border-color var(--duration-md), box-shadow var(--duration-md);
}
.uni-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-lg);
}
.uni-card__logo {
  width: 64px; height: 64px;
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
}
.uni-card__name { font-weight: 700; color: var(--text); margin-bottom: 0.25rem; }
.uni-card__meta { font-size: 0.8125rem; color: var(--text-muted); }

/* ─── Leaderboard Row ─── */
.lb-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-sm);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--surface-2); margin: 0 -0.75rem; padding-left: 0.75rem; padding-right: 0.75rem; border-radius: var(--radius-md); }
.lb-row__rank {
  width: 32px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.lb-row__rank--gold   { color: var(--gold); }
.lb-row__rank--silver { color: var(--silver); }
.lb-row__rank--bronze { color: var(--bronze); }
.lb-row__user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.625rem; }
.lb-row__name { font-size: 0.875rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row__uni  { font-size: 0.75rem; color: var(--text-muted); }
.lb-row__score { font-size: 0.875rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ─── Challenge Card ─── */
.challenge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.125rem;
  transition: transform var(--duration-md), border-color var(--duration-md), box-shadow var(--duration-md);
  cursor: pointer;
  display: block;
}
.challenge-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
.challenge-card--solved {
  border-color: rgba(34,197,94,0.2);
}
.challenge-card__header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 0.5rem; gap: 0.5rem;
}
.challenge-card__title { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.challenge-card__pts {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.challenge-card__desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 0.875rem; }
.challenge-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.challenge-card__solvers { font-size: 0.75rem; color: var(--text-subtle); display: flex; align-items: center; gap: 0.25rem; }

/* ─── Activity Feed ─── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}
.activity-icon--solve   { background: var(--success-soft); color: var(--success); }
.activity-icon--blood   { background: var(--blood-soft); color: var(--blood); }
.activity-icon--event   { background: var(--info-soft); color: var(--info); }
.activity-icon--notify  { background: var(--primary-soft); color: var(--primary); }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 0.875rem; color: var(--text); line-height: 1.5; }
.activity-text strong { color: var(--text); font-weight: 600; }
.activity-text a { color: var(--primary); }
.activity-time { font-size: 0.75rem; color: var(--text-subtle); margin-top: 0.125rem; }

/* ─── Instance Widget ─── */
.instance-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-sm);
}
.instance-row:hover { border-color: var(--border-2); }
.instance-status {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.instance-status--running  { background: var(--success); box-shadow: 0 0 6px var(--success); animation: pulse 2s infinite; }
.instance-status--starting { background: var(--warning); animation: pulse 1s infinite; }
.instance-status--stopping { background: var(--danger); }
.instance-status--error    { background: var(--danger); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.instance-info { flex: 1; min-width: 0; }
.instance-name { font-size: 0.875rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.instance-meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.instance-timer { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600; color: var(--warning); flex-shrink: 0; }

/* ─── Announcement card (dashboard) ─── */
.ann-card-ds {
  padding: 0.875rem 1rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--primary);
  transition: background var(--duration-sm);
}
.ann-card-ds:hover { background: var(--surface-3); }
.ann-card-ds--warning { border-left-color: var(--warning); }
.ann-card-ds--danger  { border-left-color: var(--danger); }
.ann-card-ds--success { border-left-color: var(--success); }
.ann-card-ds__title { font-size: 0.875rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.ann-card-ds__body  { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; }
.ann-card-ds__date  { font-size: 0.6875rem; color: var(--text-subtle); margin-top: 0.375rem; }

/* ─── Rank display ─── */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  background: var(--gradient-rank);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: #0B0F1A;
}
.rank-number {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-rank);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ─── XP / Level bar ─── */
.xp-bar-wrap { margin-top: 0.5rem; }
.xp-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.375rem;
}
.xp-label-val { font-weight: 600; color: var(--accent); }

/* ─── Hero profile card ─── */
.profile-hero {
  background: var(--gradient-card);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
}
.profile-hero__top { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.profile-hero__name { font-size: 1.25rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.profile-hero__uni  { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }
.profile-hero__ranks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.rank-mini {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  text-align: center;
}
.rank-mini__label { font-size: 0.6875rem; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25rem; }
.rank-mini__value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-mini__value--global { background: var(--gradient-rank); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.rank-mini__value--uni { color: var(--primary); }

/* ─── Next action CTA ─── */
.next-action-card {
  background: var(--gradient-primary);
  border-radius: var(--radius-2xl);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.next-action-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.next-action-card::after {
  content: '';
  position: absolute;
  bottom: -20px; right: 40px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.next-action-card__eyebrow { font-size: 0.75rem; font-weight: 600; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.375rem; }
.next-action-card__title { font-size: 1.0625rem; font-weight: 700; color: white; margin-bottom: 0.375rem; }
.next-action-card__sub { font-size: 0.8125rem; color: rgba(255,255,255,0.7); margin-bottom: 1rem; }
.next-action-card .btn-white {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
}
.next-action-card .btn-white:hover { background: rgba(255,255,255,0.25); }

/* ─── Category donut placeholder ─── */
.category-list { display: flex; flex-direction: column; gap: 0.5rem; }
.category-row { display: flex; align-items: center; gap: 0.75rem; }
.category-row__label { font-size: 0.8125rem; color: var(--text-muted); width: 70px; flex-shrink: 0; }
.category-row__bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: var(--radius-full); overflow: hidden; }
.category-row__bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.8s var(--ease); }
.category-row__count { font-size: 0.8125rem; font-weight: 600; color: var(--text); width: 24px; text-align: right; flex-shrink: 0; }


/* ════════════════════════════════════════════════════
   HERO SECTION
════════════════════════════════════════════════════ */
.pub-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--gradient-hero);
  padding: 8rem 2rem 5rem;
}
.pub-hero__bg-mesh {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(16,217,180,0.06) 0%, transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(139,92,246,0.06) 0%, transparent 40%);
  pointer-events: none;
}
.pub-hero__grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.pub-hero__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  position: relative;
  z-index: 1;
}
.pub-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.875rem;
  background: var(--primary-soft);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 1.5rem;
}
.pub-hero__tag-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 2s infinite;
}
.pub-hero__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 1.25rem;
}
.pub-hero__title-accent {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pub-hero__sub {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 2rem;
  max-width: 480px;
}
.pub-hero__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.pub-hero__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pub-hero__visual {
  position: relative;
}
.pub-hero__mockup {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl), var(--primary-glow);
  transform: perspective(1000px) rotateY(-6deg) rotateX(3deg);
  transition: transform 0.5s var(--ease);
}
.pub-hero__mockup:hover {
  transform: perspective(1000px) rotateY(-2deg) rotateX(1deg);
}
.mockup-header {
  background: var(--surface-2);
  padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.mockup-dot { width: 10px; height: 10px; border-radius: 50%; }
.mockup-bar {
  flex: 1; height: 20px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
}
.mockup-body { padding: 1rem; }
.mockup-row {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.375rem;
}
.mockup-row:hover { background: var(--surface-2); }
.mockup-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.mockup-name { flex: 1; height: 10px; background: var(--surface-3); border-radius: var(--radius-full); }
.mockup-score { width: 40px; height: 10px; background: var(--accent-soft); border-radius: var(--radius-full); }


/* ════════════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.anim-fade-up { animation: fadeInUp 0.5s var(--ease) both; }
.anim-fade    { animation: fadeIn 0.4s var(--ease) both; }
.anim-scale   { animation: scaleIn 0.3s var(--ease-bounce) both; }
.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }


/* ════════════════════════════════════════════════════
   UTILITIES
════════════════════════════════════════════════════ */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-5  { gap: 1.25rem; }
.gap-6  { gap: 1.5rem; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: 700; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ─── Grid helpers ─── */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }


/* ════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 220px; }
  .pub-hero__inner { grid-template-columns: 1fr; gap: 2rem; }
  .pub-hero__visual { display: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .steps-grid::before { display: none; }
  .preview-grid { grid-template-columns: 1fr; }
  .pub-footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
  .col-span-8 { grid-column: span 12; }
  .col-span-4 { grid-column: span 12; }
  .col-span-7 { grid-column: span 12; }
  .col-span-5 { grid-column: span 12; }
}
@media (max-width: 768px) {
  .pub-nav__wordmark { font-size: 1.25rem; }
  .pub-nav__links { display: none; }
  .pub-nav__hamburger { display: flex; }
  .pub-nav__actions .btn-ghost { display: none; }
  .pub-section { padding: 3rem 1.25rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .app-main { margin-left: 0; }
  .app-content { padding: 1rem; }
  .dash-grid { grid-template-columns: 1fr; }
  .col-span-12, .col-span-8, .col-span-4, .col-span-6, .col-span-7, .col-span-5, .col-span-3 { grid-column: span 1; }
  .pub-footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .pub-footer__bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
  .profile-hero__ranks { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  :root { --topbar-h: 56px; }
  .pub-hero { padding: 6rem 1.25rem 3rem; }
  .pub-hero__title { font-size: 2rem; }
  .pub-hero__actions { flex-direction: column; align-items: flex-start; }
}

/* ── Rich content (Quill rendered HTML) ───────────────────────────── */
.rich-content { font-size: .9375rem; color: var(--text); line-height: 1.85; }
.rich-content h1, .rich-content h2, .rich-content h3 {
  color: var(--text); font-weight: 700; margin: 1.25rem 0 .5rem;
}
.rich-content h1 { font-size: 1.5rem; }
.rich-content h2 { font-size: 1.25rem; }
.rich-content h3 { font-size: 1.0625rem; }
.rich-content p  { margin: 0 0 .75rem; }
.rich-content strong, .rich-content b { font-weight: 700; }
.rich-content em, .rich-content i { font-style: italic; }
.rich-content u  { text-decoration: underline; }
.rich-content s  { text-decoration: line-through; }
.rich-content a  { color: var(--primary); text-decoration: underline; word-break: break-word; }
.rich-content a:hover { color: var(--accent); }
.rich-content ul, .rich-content ol { padding-left: 1.5rem; margin: .5rem 0 .75rem; }
.rich-content li { margin-bottom: .25rem; }
.rich-content blockquote {
  border-left: 3px solid var(--primary); margin: .75rem 0;
  padding: .5rem 1rem; color: var(--text-muted);
  background: rgba(139,92,246,.06); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.rich-content pre {
  background: var(--base); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: .875rem 1rem;
  font-family: var(--font-mono); font-size: .8125rem; overflow-x: auto; margin: .75rem 0;
}
.rich-content code {
  background: rgba(139,92,246,.1); color: var(--accent);
  padding: .125rem .35rem; border-radius: 4px;
  font-family: var(--font-mono); font-size: .85em;
}
.rich-content pre code { background: none; color: var(--text); padding: 0; border-radius: 0; }
.rich-content img {
  max-width: 100%; border-radius: var(--radius-md);
  margin: .625rem 0; display: block;
}
.rich-content .ql-align-center { text-align: center; }
.rich-content .ql-align-right  { text-align: right; }
.rich-content .ql-align-justify { text-align: justify; }

/* Global one-time announcement popup */
.global-announcement {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-md) var(--ease);
}
.global-announcement.is-open {
  opacity: 1;
  pointer-events: auto;
}
.global-announcement__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.2), transparent 45%),
              rgba(7, 10, 18, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.global-announcement__card {
  position: relative;
  width: min(680px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.22);
  background: linear-gradient(140deg, rgba(255,255,255,0.16), rgba(255,255,255,0.07));
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.18);
  padding: 1.25rem 1.25rem 1rem;
  transform: translateY(14px) scale(0.98);
  transition: transform var(--duration-md) var(--ease);
}
.global-announcement.is-open .global-announcement__card {
  transform: translateY(0) scale(1);
}
.global-announcement__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(226,232,247,0.82);
  margin-bottom: 0.55rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.26);
  background: rgba(11, 15, 26, 0.32);
}
.global-announcement__title {
  font-size: clamp(1.05rem, 2.5vw, 1.45rem);
  line-height: 1.25;
  margin-bottom: 0.55rem;
  color: #f4f7ff;
}
.global-announcement__body {
  color: rgba(226,232,247,0.95);
  line-height: 1.65;
  margin-bottom: 1rem;
}
@media (max-width: 640px) {
  .global-announcement__card {
    padding: 1rem 0.9rem 0.85rem;
    border-radius: 16px;
  }
  .global-announcement__body {
    font-size: 0.9rem;
  }
}

/* ===== Mobile hardening: prevent overflow and improve small-screen UX ===== */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-main,
.app-content,
.dash-grid,
.card,
.ds-table-wrap {
  min-width: 0;
}

@media (max-width: 768px) {
  .app-topbar {
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
    min-height: auto;
    flex-wrap: wrap;
  }

  .app-topbar__search {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    min-width: 0;
  }

  .app-topbar__actions {
    margin-left: auto;
    gap: 0.4rem;
    min-width: 0;
  }

  .topbar-user {
    padding-right: 0.35rem;
  }

  .topbar-user__name {
    display: none;
  }

  .topbar-notif-dropdown {
    min-width: min(92vw, 320px);
    max-width: min(92vw, 360px);
    right: -8px;
  }

  .ds-dropdown {
    max-width: min(92vw, 360px);
  }

  .ds-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ds-table {
    min-width: 560px;
  }

  .home-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
    padding: 1.25rem 1rem !important;
  }

  .home-stats-grid > div {
    border-left: none !important;
    padding: 0.25rem 0;
  }

  .home-universities-grid,
  .home-live-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

@media (max-width: 480px) {
  .app-content {
    padding: 0.875rem;
  }

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

/* ===== Mobile fix for public landing (narrow screens) ===== */
@media (max-width: 768px) {
  .pub-nav {
    height: 56px;
  }

  .pub-nav__inner {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .pub-nav__logo {
    min-width: 0;
    max-width: calc(100% - 140px);
    overflow: hidden;
  }

  .pub-nav__wordmark {
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pub-nav__actions {
    margin-left: auto;
    gap: 0.35rem;
    min-width: 0;
  }

  .pub-nav__actions .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .pub-nav__mobile {
    top: 56px;
  }

  .pub-hero {
    padding: 5.5rem 1rem 2.5rem;
  }

  .pub-hero__inner,
  .pub-hero__copy,
  .pub-hero__sub {
    max-width: 100%;
    min-width: 0;
  }

  .pub-hero__title {
    font-size: clamp(2rem, 10vw, 2.7rem);
  }
}

@media (max-width: 420px) {
  .pub-nav__wordmark-cyber {
    display: none;
  }

  .pub-nav__wordmark-rank {
    margin-left: 0;
  }

  .pub-nav__actions .btn-primary {
    padding: 0.4rem 0.58rem;
    font-size: 0.7rem;
  }
}

/* ===== Mobile navbar hotfix (menu visibility + no overlap) ===== */
[x-cloak] { display: none !important; }

@media (max-width: 768px) {
  .pub-nav__actions {
    display: none !important;
  }

  .pub-nav__hamburger {
    margin-left: auto;
    width: 34px;
    height: 34px;
  }

  .pub-nav__mobile {
    z-index: 160;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    border-top: 1px solid var(--border);
  }

  .pub-nav__mobile-link {
    color: var(--text);
    font-weight: 500;
  }
}


/* ===== Challenge list mobile layout ===== */
.challenge-stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}

.challenge-stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.7rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.challenge-stats-card__value {
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

.challenge-stats-card__value--primary { color: var(--primary); }
.challenge-stats-card__value--success { color: var(--success); }
.challenge-stats-card__value--accent { color: var(--accent); }

.challenge-stats-card__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 0;
}

.challenge-filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  margin-bottom: 1.75rem;
}

.challenge-filters__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.challenge-filters__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.challenge-filter-chip {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
}

.challenge-filter-chip--active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.challenge-filters__controls {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.challenge-filters__difficulty {
  height: 34px;
  width: 100%;
  padding: 0 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
}

.challenge-filters__search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.375rem;
  align-items: center;
  min-width: 0;
}

.challenge-filters__search-input {
  height: 34px;
  width: 100% !important;
  min-width: 0;
}

.challenge-filters__search-btn {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .challenge-stats-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.625rem;
  }

  .challenge-stats-card {
    padding: 0.65rem 0.7rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .challenge-stats-card__value {
    font-size: 1.05rem;
  }

  .challenge-filters {
    padding: 0.8rem;
  }

  .challenge-filters__controls {
    grid-template-columns: 1fr;
  }

  .challenge-filters__difficulty {
    min-width: 0;
  }

  .page-header__title {
    font-size: 1.75rem;
    line-height: 1.08;
  }

  .page-header__sub {
    max-width: 32ch;
  }
}

@media (max-width: 480px) {
  .challenge-stats-strip {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .challenge-filter-chip {
    padding: 0.34rem 0.62rem;
    font-size: 0.78rem;
  }

  .challenge-filters__search {
    grid-template-columns: minmax(0, 1fr) 40px;
  }
}
