html:has(body.kouli-progress-active),
html:has(body.kouli-profile-active),
html:has(body.kouli-home-active) {
  background-color: #07070d;
}

body.kouli-progress-active {
  background:
    radial-gradient(circle at 50% 6%, rgba(122, 153, 171, 0.22), transparent 40%),
    radial-gradient(circle at 82% 34%, rgba(74, 93, 110, 0.16), transparent 36%),
    radial-gradient(circle at 14% 74%, rgba(74, 93, 110, 0.12), transparent 44%),
    linear-gradient(180deg, #07070d 0%, #0a0711 46%, #040407 100%);
  background-color: #07070d;
  background-attachment: fixed;
  color: #fff;
}

body.kouli-progress-active #app-header {
  display: none;
}

body.kouli-progress-active #progress-page {
  min-height: calc(100vh - 78px);
  padding: max(18px, env(safe-area-inset-top)) 18px 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 14%),
    radial-gradient(circle at 50% 12%, rgba(122, 153, 171, 0.16), transparent 38%);
  color: #fff;
}

body.kouli-progress-active #progress-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 78%);
}

body.kouli-progress-active #progress-page > * {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

body.kouli-progress-active .progress-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

body.kouli-progress-active .progress-title-section h1 {
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  font-weight: 860;
}

body.kouli-progress-active .progress-title-section p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 1rem;
  line-height: 1.45;
}

body.kouli-progress-active .export-btn,
body.kouli-progress-active #progress-page .export-btn,
body.kouli-progress-active .export-btn:hover,
body.kouli-progress-active #progress-page .export-btn:hover {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(255, 255, 255, 0.82) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: none !important;
}

body.kouli-progress-active .export-btn svg,
body.kouli-progress-active #progress-page .export-btn svg {
  color: rgba(184, 205, 216, 0.9) !important;
}

body.kouli-progress-active .xp-level-card,
body.kouli-progress-active .mascot-carousel-card,
body.kouli-progress-active .metric-card,
body.kouli-progress-active .skills-section,
body.kouli-progress-active .confidence-trend-section,
body.kouli-progress-active .history-section,
body.kouli-progress-active .daily-challenges-section,
body.kouli-progress-active .calendar-section,
body.kouli-progress-active .accountability-section,
body.kouli-progress-active .monthly-insights-section {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028)),
    rgba(8, 8, 18, 0.78);
  color: #fff;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.065);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.kouli-progress-active .xp-level-card,
body.kouli-progress-active .mascot-carousel-card {
  border-radius: 22px;
}

body.kouli-progress-active .metric-card {
  border-radius: 18px;
}

body.kouli-progress-active .skills-section,
body.kouli-progress-active .confidence-trend-section,
body.kouli-progress-active .history-section,
body.kouli-progress-active .daily-challenges-section,
body.kouli-progress-active .calendar-section {
  border-radius: 22px;
  padding: 18px;
  margin-top: 18px;
}

body.kouli-progress-active .xp-level-section,
body.kouli-progress-active .progress-metrics {
  margin-top: 18px;
}

body.kouli-progress-active .progress-metrics {
  gap: 12px;
}

body.kouli-progress-active .metric-top-accent {
  background: linear-gradient(90deg, #4a5d6e, #3b82f6, #22d3ee);
  opacity: 0.9;
}

body.kouli-progress-active .metric-number {
  color: #fff;
  text-shadow: 0 0 28px rgba(122, 153, 171, 0.28);
}

body.kouli-progress-active .metric-card:first-child .metric-number {
  background: linear-gradient(90deg, #fff, #b8cdd8, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.kouli-progress-active .metric-label,
body.kouli-progress-active .level-label,
body.kouli-progress-active .xp-total,
body.kouli-progress-active .xp-progress-label-row,
body.kouli-progress-active .xp-progress-text,
body.kouli-progress-active .mascot-status-label,
body.kouli-progress-active .mascot-tier-label,
body.kouli-progress-active .confidence-trend-intro,
body.kouli-progress-active .challenges-potential,
body.kouli-progress-active .calendar-monthly-summary,
body.kouli-progress-active .calendar-legend,
body.kouli-progress-active .history-header p {
  color: rgba(255, 255, 255, 0.58);
}

body.kouli-progress-active .level-name,
body.kouli-progress-active .mascot-label,
body.kouli-progress-active .history-header h3,
body.kouli-progress-active .challenges-header h3,
body.kouli-progress-active .calendar-header h3,
body.kouli-progress-active .confidence-trend-section h3,
body.kouli-progress-active .section-title {
  color: rgba(255, 255, 255, 0.94);
}

body.kouli-progress-active .section-title,
body.kouli-progress-active .confidence-trend-section h3,
body.kouli-progress-active .history-header h3,
body.kouli-progress-active .challenges-header h3,
body.kouli-progress-active .calendar-header h3 {
  margin-bottom: 8px;
  font-size: 0.76rem;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.54);
}

body.kouli-progress-active .level-number-badge {
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.42), transparent 28%),
    linear-gradient(180deg, #4a5d6e, #2a3744);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

body.kouli-progress-active .xp-progress-bar,
body.kouli-progress-active .kouli-sprint-bar {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.kouli-progress-active .xp-progress-fill,
body.kouli-progress-active .kouli-sprint-fill {
  background: linear-gradient(90deg, #3b82f6, #22d3ee);
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.35);
}

body.kouli-progress-active .xp-milestone-marker {
  color: rgba(255, 255, 255, 0.62);
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.28);
}

body.kouli-progress-active .metric-trend-chip,
body.kouli-progress-active .metric-freeze-btn,
body.kouli-progress-active .daily-challenge-tone-pill {
  border-color: rgba(122, 153, 171, 0.35);
  background: rgba(74, 93, 110, 0.18);
  color: rgba(226, 232, 240, 0.92);
}

body.kouli-progress-active .metric-click-hint,
body.kouli-progress-active .metric-freeze-caption {
  color: rgba(255, 255, 255, 0.45);
}

body.kouli-progress-active .confidence-trend-chart,
body.kouli-progress-active .history-list,
body.kouli-progress-active .challenges-container,
body.kouli-progress-active .calendar-grid {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
}

body.kouli-progress-active .calendar-weekdays,
body.kouli-progress-active .weekday {
  color: rgba(255, 255, 255, 0.5);
}

body.kouli-progress-active .calendar-days .calendar-day,
body.kouli-progress-active .calendar-days > div {
  color: rgba(255, 255, 255, 0.72);
}

body.kouli-progress-active .challenges-header svg,
body.kouli-progress-active .calendar-header svg {
  color: rgba(184, 205, 216, 0.9);
}

body.kouli-progress-active #progress-mid-interview-note {
  background: rgba(74, 93, 110, 0.18) !important;
  border-color: rgba(122, 153, 171, 0.35) !important;
  color: rgba(255, 255, 255, 0.84) !important;
}

/* Higher-specificity overrides to defeat existing #progress-page rules. */
body.kouli-progress-active #progress-page .xp-level-card,
body.kouli-progress-active #progress-page .mascot-carousel-card,
body.kouli-progress-active #progress-page .metric-card,
body.kouli-progress-active #progress-page .skills-section,
body.kouli-progress-active #progress-page .confidence-trend-section,
body.kouli-progress-active #progress-page .history-section,
body.kouli-progress-active #progress-page .daily-challenges-section,
body.kouli-progress-active #progress-page .calendar-section {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.028)),
    rgba(8, 8, 18, 0.78);
  border-color: rgba(255, 255, 255, 0.13);
  color: #fff;
}

body.kouli-progress-active #progress-page .challenges-header {
  background: transparent;
  border: 0;
  margin-bottom: 12px;
  padding: 0;
}

body.kouli-progress-active #progress-page .challenges-header svg {
  color: rgba(184, 205, 216, 0.92);
}

body.kouli-progress-active #progress-page .challenges-container {
  background: transparent;
  border: 0;
  padding: 0;
}

body.kouli-progress-active #progress-page .daily-challenge,
body.kouli-progress-active #progress-page .challenge-item {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.kouli-progress-active #progress-page .daily-challenge .daily-challenge-title,
body.kouli-progress-active #progress-page .daily-challenge .daily-challenge-name,
body.kouli-progress-active #progress-page .challenge-item .challenge-title,
body.kouli-progress-active #progress-page .challenge-item .challenge-name {
  color: rgba(255, 255, 255, 0.96);
}

body.kouli-progress-active #progress-page .daily-challenge .daily-challenge-description,
body.kouli-progress-active #progress-page .challenge-item .challenge-description,
body.kouli-progress-active #progress-page .challenge-item .challenge-content p {
  color: rgba(255, 255, 255, 0.62);
}

body.kouli-progress-active #progress-page .daily-challenge .progress-bar,
body.kouli-progress-active #progress-page .challenge-item .progress-bar,
body.kouli-progress-active #progress-page .challenge-progress {
  background: rgba(255, 255, 255, 0.08);
}

body.kouli-progress-active #progress-page .daily-challenge .progress-fill,
body.kouli-progress-active #progress-page .challenge-item .progress-fill,
body.kouli-progress-active #progress-page .challenge-progress-fill {
  background: linear-gradient(90deg, #3b82f6, #22d3ee);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.3);
}

body.kouli-progress-active #progress-page .daily-challenge .challenge-xp,
body.kouli-progress-active #progress-page .challenge-item .challenge-xp,
body.kouli-progress-active #progress-page .daily-challenge .xp-pill,
body.kouli-progress-active #progress-page .challenge-item .xp-pill {
  background: rgba(74, 93, 110, 0.2);
  border-color: rgba(122, 153, 171, 0.35);
  color: rgba(226, 232, 240, 0.96);
}

/* 2026-06-02: Dark-theme overrides for the ACTUAL daily-challenge markup
   produced by renderDailyChallenges() in main.js. Earlier overrides in
   this file targeted .challenge-title / .challenge-name / .challenge-xp
   classes that the renderer never emits — the real DOM is
   `.daily-challenge > .challenge-header > h4` and `.challenge-reward`.
   Without these rules the light-theme fallbacks won (var(--foreground)
   ≈ dark slate text, var(--accent) ≈ teal pill), so titles like "High
   Achiever" rendered dark-on-dark and the "+30 XP" pill sat on a low-
   contrast teal. */
body.kouli-progress-active #progress-page .daily-challenge .challenge-header h4 {
  color: rgba(255, 255, 255, 0.96);
  font-weight: 700;
}

body.kouli-progress-active #progress-page .daily-challenge .challenge-reward {
  background: rgba(74, 93, 110, 0.24);
  border: 1px solid rgba(122, 153, 171, 0.42);
  color: rgba(226, 232, 240, 0.98);
  padding: 4px 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.kouli-progress-active #progress-page .daily-challenge .challenge-description {
  color: rgba(255, 255, 255, 0.7);
}

body.kouli-progress-active #progress-page .daily-challenge .progress-text {
  color: rgba(255, 255, 255, 0.82);
}

body.kouli-progress-active #progress-page .daily-challenge .challenge-completed {
  color: rgba(0, 196, 160, 0.92);
}

/* Completed-state surface — pulls the whole card slightly forward so a
   finished challenge reads as a small win, not as background noise. */
body.kouli-progress-active #progress-page .daily-challenge.completed {
  background: rgba(0, 196, 160, 0.08);
  border-color: rgba(0, 196, 160, 0.32);
}

body.kouli-progress-active #progress-page .daily-challenge.completed .challenge-header h4 {
  color: rgba(226, 240, 236, 1);
}

/* Confidence Trend — beats the 2-ID rule in index.html */
body.kouli-progress-active #progress-page #confidence-trend-section.confidence-trend-section {
  display: block;
  width: 100%;
  max-width: 920px;
  margin: 18px auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(8, 8, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  color: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.kouli-progress-active #progress-page #confidence-trend-section.confidence-trend-section h3 {
  color: rgba(255, 255, 255, 0.54);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

body.kouli-progress-active #progress-page #confidence-trend-section.confidence-trend-section .confidence-trend-intro {
  color: rgba(255, 255, 255, 0.58);
}

body.kouli-progress-active #progress-page .confidence-trend-chart {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.72);
}

body.kouli-progress-active #progress-page .confidence-trend-empty {
  color: rgba(255, 255, 255, 0.55);
}

body.kouli-progress-active #progress-page .confidence-trend-chart-wrap svg.confidence-trend-svg .confidence-trend-grid {
  stroke: rgba(255, 255, 255, 0.08);
}

body.kouli-progress-active #progress-page .confidence-trend-chart-wrap svg.confidence-trend-svg .confidence-trend-axis {
  fill: rgba(255, 255, 255, 0.74);
}

body.kouli-progress-active #progress-page .confidence-trend-chart-wrap svg.confidence-trend-svg .confidence-trend-xlabel {
  fill: rgba(255, 255, 255, 0.58);
}

body.kouli-progress-active #progress-page .confidence-trend-pill {
  color: rgba(226, 232, 240, 0.96);
  background: rgba(74, 93, 110, 0.18);
  border-color: rgba(122, 153, 171, 0.35);
}

/* Force-white headings on the Progress page (override stray teal/dark from light theme). */
body.kouli-progress-active #progress-page .progress-title-section h1,
body.kouli-progress-active #progress-page .progress-title-section p,
body.kouli-progress-active #progress-page .challenges-header h3,
body.kouli-progress-active #progress-page .calendar-header h3,
body.kouli-progress-active #progress-page .challenge-item .challenge-text,
body.kouli-progress-active #progress-page .daily-challenge .challenge-text {
  color: #fff !important;
}

/* Calendar inner pieces */
body.kouli-progress-active #progress-page .calendar-monthly-summary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 8px 14px;
}

body.kouli-progress-active #progress-page .calendar-day {
  color: rgba(255, 255, 255, 0.78);
}

body.kouli-progress-active #progress-page .calendar-day.other-month {
  color: rgba(255, 255, 255, 0.28);
}

body.kouli-progress-active #progress-page .calendar-day.today {
  border-color: rgba(0, 196, 160, 0.92);
  color: #fff;
}

body.kouli-progress-active #progress-page .calendar-day-header,
body.kouli-progress-active #progress-page .weekday {
  color: rgba(255, 255, 255, 0.5);
}

body.kouli-progress-active #progress-page .calendar-legend .legend-item {
  color: rgba(255, 255, 255, 0.62);
}

/* History items */
body.kouli-progress-active #progress-page .history-item {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

body.kouli-progress-active #progress-page .history-item:hover {
  border-color: rgba(122, 153, 171, 0.45);
  background: rgba(74, 93, 110, 0.12);
}

body.kouli-progress-active #progress-page .history-date,
body.kouli-progress-active #progress-page .history-item .history-score {
  color: #fff;
}

@media (max-width: 640px) {
  body.kouli-progress-active #progress-page {
    padding-left: 16px;
    padding-right: 16px;
  }

  body.kouli-progress-active .progress-header {
    align-items: flex-start;
  }

  body.kouli-progress-active .export-btn {
    min-width: 42px;
  }

  body.kouli-progress-active .skills-section,
  body.kouli-progress-active .confidence-trend-section,
  body.kouli-progress-active .history-section,
  body.kouli-progress-active .daily-challenges-section,
  body.kouli-progress-active .calendar-section {
    padding: 16px;
  }

  body.kouli-progress-active #progress-page #confidence-trend-section.confidence-trend-section {
    margin: 16px auto;
    padding: 16px;
  }
}

/* Practice Trends — per-mode session count + confidence direction (stock-ticker style) */
body.kouli-progress-active #progress-page .mode-trends-grid,
body.kouli-progress-active #progress-page .mode-trends-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

body.kouli-progress-active #progress-page .mode-trends-empty {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  padding: 8px 2px;
}

body.kouli-progress-active #progress-page .mode-trend-card {
  position: relative;
  padding: 14px 14px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

body.kouli-progress-active #progress-page .mode-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body.kouli-progress-active #progress-page .mode-trend-name {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.82);
}

body.kouli-progress-active #progress-page .mode-trend-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}

body.kouli-progress-active #progress-page .mode-trend-badge--up {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.32);
}

body.kouli-progress-active #progress-page .mode-trend-badge--down {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.32);
}

body.kouli-progress-active #progress-page .mode-trend-badge--flat,
body.kouli-progress-active #progress-page .mode-trend-badge--na {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}

body.kouli-progress-active #progress-page .mode-trend-count {
  margin-top: 10px;
  font-size: 2rem;
  line-height: 1;
  font-weight: 820;
  letter-spacing: -0.03em;
  color: #fff;
}

body.kouli-progress-active #progress-page .mode-trend-label {
  margin-top: 2px;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.5);
}

body.kouli-progress-active #progress-page .mode-trend-spark {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 10px;
}

body.kouli-progress-active #progress-page .mode-trend-spark .mode-trend-spark-line {
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

body.kouli-progress-active #progress-page .mode-trend-spark--up .mode-trend-spark-line {
  stroke: #34d399;
}

body.kouli-progress-active #progress-page .mode-trend-spark--down .mode-trend-spark-line {
  stroke: #f87171;
}
