:root {
  --bg: #06090d;
  --bg-2: #0b1118;
  --glass: rgba(12, 18, 26, 0.58);
  --glass-strong: rgba(10, 16, 24, 0.78);
  --stroke: rgba(94, 234, 212, 0.14);
  --stroke-strong: rgba(62, 232, 181, 0.32);
  --text: #e8eef4;
  --muted: #8b9aab;
  --faint: #5b6b7c;
  --accent: #3ee8b5;
  --accent-2: #67e8f9;
  --done: #3ee8b5;
  --progress: #38bdf8;
  --idle: #334155;
  --easy: #4ade80;
  --medium: #fbbf24;
  --hard: #fb7185;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --radius: 20px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.03em;
}

h1 {
  font-size: 1.15rem;
}

h2 {
  font-size: 1.35rem;
}

p {
  margin: 0;
}

code,
pre {
  font-family: var(--mono);
}

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

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(62, 232, 181, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(62, 232, 181, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 20%, black 20%, transparent 75%);
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  opacity: 0.35;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
}

.orb-a {
  width: 420px;
  height: 420px;
  top: -80px;
  right: 8%;
  background: #0f766e;
  animation: drift 18s ease-in-out infinite;
}

.orb-b {
  width: 360px;
  height: 360px;
  bottom: 4%;
  left: -40px;
  background: #1d4ed8;
  animation: drift 22s ease-in-out infinite reverse;
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(36px, -24px);
  }
}

.app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 22px;
}

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

.mark {
  color: var(--accent);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(62, 232, 181, 0.08);
  border: 1px solid var(--stroke);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.topbar-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(62, 232, 181, 0.08);
  color: var(--accent);
}

.pill.dim {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-card,
.ring-card {
  padding: 28px;
}

.lede {
  color: var(--muted);
  max-width: 46ch;
  margin: 10px 0 22px;
  font-weight: 300;
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-stat {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.mini-stat span {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.mini-stat strong {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.ring-card {
  display: grid;
  place-items: center;
  text-align: center;
}

.ring-wrap {
  position: relative;
  width: 180px;
  height: 180px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 10;
}

.ring-track {
  stroke: rgba(255, 255, 255, 0.06);
}

.ring-value {
  stroke: url(#none);
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 351.86;
  stroke-dashoffset: 351.86;
  filter: drop-shadow(0 0 8px rgba(62, 232, 181, 0.45));
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
}

.ring-center strong {
  font-size: 2rem;
  letter-spacing: -0.05em;
  line-height: 1;
}

.ring-center span {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 6px;
}

.ring-caption {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  padding: 18px 18px 16px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.kpi:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
}

.kpi .label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi .value {
  display: block;
  font-size: 1.8rem;
  margin: 8px 0 10px;
  letter-spacing: -0.05em;
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel {
  padding: 24px;
  margin-bottom: 16px;
}

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

.section-head {
  padding: 0 4px;
}

.panel-stat {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.82rem;
}

.challenge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.challenge {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.challenge header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.challenge h3 {
  font-size: 1rem;
  font-weight: 500;
}

.challenge .frac {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.challenge .pct {
  font-size: 1.6rem;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}

.challenge.easy .pct { color: var(--easy); }
.challenge.medium .pct { color: var(--medium); }
.challenge.hard .pct { color: var(--hard); }

.challenge.easy .bar > i { background: var(--easy); }
.challenge.medium .bar > i { background: var(--medium); }
.challenge.hard .bar > i { background: var(--hard); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.cat {
  padding: 20px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.cat:hover {
  transform: translateY(-3px);
  border-color: var(--stroke-strong);
}

.cat-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.pie {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 24px rgba(0, 0, 0, 0.25);
}

.pie::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.cat h3 {
  font-size: 1.05rem;
}

.cat .all {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stack div {
  padding: 8px 8px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.stack span {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.stack strong {
  font-size: 1.05rem;
  font-weight: 600;
}

.stack .done strong { color: var(--done); }
.stack .wip strong { color: var(--progress); }

.legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  display: inline-block;
}

.swatch.done { background: var(--done); box-shadow: 0 0 8px var(--done); }
.swatch.progress { background: var(--progress); }

.chart-wrap {
  overflow: hidden;
}

#trend-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-label {
  fill: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.06);
}

.foot {
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  margin-top: 8px;
}

.foot code {
  color: var(--accent);
  font-size: 0.8rem;
}

.error-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 10, 0.72);
  padding: 24px;
}

.error-card {
  max-width: 480px;
  padding: 28px;
}

.error-card p {
  color: var(--muted);
  margin: 10px 0;
}

.error-card pre {
  background: rgba(0, 0, 0, 0.35);
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--accent);
  overflow-x: auto;
}

[hidden] {
  display: none !important;
}

@media (max-width: 960px) {
  .hero-grid,
  .kpi-row,
  .challenge-grid,
  .category-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .topbar,
  .hero-grid,
  .kpi-row,
  .challenge-grid,
  .category-grid,
  .hero-kpis {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-head,
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
