:root {
    --bg: #050716;
    --bg-elevated: rgba(17, 24, 39, 0.92);
    --accent: #5eead4;
    --accent-soft: rgba(94, 234, 212, 0.12);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border-subtle: rgba(148, 163, 184, 0.3);
    --danger: #f97373;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --shadow-soft: 0 18px 60px rgba(15, 23, 42, 0.7);
    --transition-fast: 180ms ease-out;
    --transition-med: 260ms ease;
  }
  
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  
  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
  }
  
  body {
    font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
      radial-gradient(circle at top left, rgba(94, 234, 212, 0.18), transparent 55%),
      radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.18), transparent 55%),
      var(--bg);
    color: var(--text-main);
  }
  
  /* Layout */
  
  .app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 1.8rem;
    padding: 1.8rem 2rem;
  }
  
  @media (max-width: 900px) {
    .app {
      grid-template-columns: 1fr;
      padding: 1rem;
    }
  }
  
  /* Sidebar */
  
  .sidebar {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.85));
    border-radius: var(--radius-xl);
    padding: 1.7rem 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
  }
  
  .sidebar::before {
    content: "";
    position: absolute;
    inset: -40%;
    background:
      radial-gradient(circle at 0 0, rgba(94, 234, 212, 0.09), transparent 60%),
      radial-gradient(circle at 100% 100%, rgba(129, 140, 248, 0.1), transparent 60%);
    opacity: 0.8;
    pointer-events: none;
  }
  
  .sidebar-header {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
  }
  
  .sidebar-header h1 {
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.35rem;
  }
  
  .sidebar-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
  }
  
  /* ===== Sidebar progress: glowing line + active pulse ===== */
.level-progress {
  position: relative;
}

.level-progress::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: linear-gradient(
    to bottom,
    rgba(94, 234, 212, 0.25),
    rgba(129, 140, 248, 0.15),
    rgba(94, 234, 212, 0.05)
  );
  filter: blur(0.2px);
  border-radius: 999px;
  pointer-events: none;
}

/* Active item: slight neon rail behind */
.level-progress-item.is-current {
  background: rgba(94, 234, 212, 0.06);
  border: 1px solid rgba(94, 234, 212, 0.25);
  box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.07);
}

/* Make bullets feel "powered" */
.level-progress-item .bullet {
  position: relative;
}

.level-progress-item.is-current .bullet::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.18), transparent 60%);
  animation: pulseGlow 1.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 1; }
}

  /* Level progress */
  
  .level-progress {
    position: relative;
    z-index: 1;
    margin: 1.2rem 0 1.4rem;
    padding-left: 0.3rem;
    border-left: 1px dashed rgba(148, 163, 184, 0.4);
  }
  
  .level-progress-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.55rem 0.25rem 0.55rem 0.8rem;
    align-items: center;
    cursor: pointer;
    border-radius: 999px;
    transition: background var(--transition-fast), transform var(--transition-fast);
  }
  
  .level-progress-item:hover {
    background: rgba(15, 23, 42, 0.85);
    transform: translateX(2px);
  }
  
  .level-progress-item .bullet {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.8);
    background: transparent;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.7);
  }
  
  .level-progress-item.is-current .bullet {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.2);
  }
  
  .labels {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
  }
  
  .level-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
  }
  
  .level-title {
    font-size: 0.88rem;
  }
  
  .sidebar-footer {
    position: relative;
    z-index: 1;
    margin-top: 1.8rem;
    font-size: 0.8rem;
    color: var(--text-muted);
  }
  
  /* Main */
  
  .main {
    background: rgba(15, 23, 42, 0.93);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem 1.7rem 1.7rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }
  
  .main::before {
    content: "";
    position: absolute;
    inset: -40%;
    background:
      radial-gradient(circle at 0 100%, rgba(56, 189, 248, 0.09), transparent 55%),
      radial-gradient(circle at 100% 0, rgba(251, 191, 36, 0.1), transparent 55%);
    opacity: 0.7;
    pointer-events: none;
  }
  
  .topbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.3rem;
  }
  
  .topbar-label {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
  }
  
  #current-level-title {
    margin: 0.1rem 0 0;
    font-size: 1.1rem;
  }
  
  /* Buttons */
  
  .primary-btn,
  .ghost-btn {
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition:
      background var(--transition-fast),
      border-color var(--transition-fast),
      transform var(--transition-fast),
      box-shadow var(--transition-fast),
      color var(--transition-fast);
  }
  
  .primary-btn {
    background: linear-gradient(120deg, #22c55e, #14b8a6);
    color: #020617;
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.35);
  }
  
  .primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 15px 40px rgba(34, 197, 94, 0.45);
  }
  
  .ghost-btn {
    border-color: rgba(148, 163, 184, 0.7);
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.7);
  }
  
  .ghost-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
  
  /* ===== "Zoom" feel on primary buttons ===== */
.primary-btn {
  position: relative;
  overflow: hidden;
}

.primary-btn::after {
  content: "";
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 50%);
  transform: translateX(-30%);
  opacity: 0.0;
  transition: opacity 240ms ease, transform 240ms ease;
  pointer-events: none;
}

.primary-btn:hover::after {
  opacity: 1;
  transform: translateX(0%);
}

/* Add a subtle "arrow" vibe without icons */
.primary-btn::before {
  content: "↳";
  font-weight: 600;
  margin-right: 0.35rem;
  opacity: 0.85;
}


  /* Levels */
  
  #levels-container {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: radial-gradient(circle at top, rgba(15, 118, 110, 0.15), rgba(15, 23, 42, 0.92));
  }
  
  .level {
    position: absolute;
    inset: 0;
    padding: 1.3rem 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(0.99);
    transition:
      opacity var(--transition-med),
      transform var(--transition-med),
      filter var(--transition-med);
    filter: blur(2px);
  }
  
  .level-active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }

  .level-active {
    animation: stageIn 260ms ease;
  }
  
  @keyframes stageIn {
    from { transform: translateY(10px) scale(0.992); opacity: 0.0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
  }
  
  
  .level-intro h3 {
    margin: 0 0 0.3rem;
    font-size: 1.05rem;
  }
  
  .level-intro p {
    margin: 0;
    font-size: 0.9rem;
    max-width: 48rem;
    color: var(--text-muted);
  }
  
  /* Theory cards grid */
  
  .theory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0.4rem;
  }
  
  @media (max-width: 1100px) {
    .theory-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  
  @media (max-width: 700px) {
    .theory-grid {
      grid-template-columns: 1fr;
    }
  }
  
  .theory-card {
    background: radial-gradient(circle at top left, rgba(94, 234, 212, 0.09), rgba(15, 23, 42, 0.96));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.4);
    padding: 0.9rem 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.9);
    transition:
      transform var(--transition-med),
      box-shadow var(--transition-med),
      border-color var(--transition-med),
      background var(--transition-med);
  }
  
  .theory-card::before {
    content: "";
    position: absolute;
    inset: -40%;
    background:
      radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.16), transparent 55%);
    opacity: 0;
    transition: opacity var(--transition-med);
    pointer-events: none;
  }
  
  .theory-card:hover {
    transform: translateY(-3px) translateZ(0);
    border-color: var(--accent);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.95);
  }
  
  .theory-card:hover::before {
    opacity: 1;
  }
  
  .theory-card h4 {
    margin: 0 0 0.3rem;
    font-size: 0.98rem;
  }
  
  .theory-card p {
    margin: 0.25rem 0;
    font-size: 0.87rem;
    line-height: 1.5;
    color: var(--text-muted);
  }
  
  .theory-card .meta {
    margin-top: 0.45rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(148, 163, 184, 0.9);
  }

  /* ===== Curation & Bias special card ===== */
.theory-card-curation {
  border-color: var(--danger);
}

.theory-card-curation h4::before {
  content: "◎ ";
}

  /* Level footer */
  
  .level-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.4);
  }
  
  @media (max-width: 600px) {
    .level-footer {
      flex-direction: column-reverse;
      align-items: flex-start;
    }
  }
/* ------- Assignment PDF panel (Level 2) ------- */

.assignment-panel {
  margin-top: 1.2rem;
  padding: 0.9rem 1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.7);
}

.assignment-panel h4 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
}

.assignment-panel-text {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 800px) {
  .assignment-grid {
    grid-template-columns: 1fr;
  }
}

.assignment-card {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at top left,
    rgba(94, 234, 212, 0.08),
    rgba(15, 23, 42, 0.95)
  );
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition:
    background 180ms ease-out,
    border-color 180ms ease-out,
    transform 180ms ease-out,
    box-shadow 180ms ease-out;
}

.assignment-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.9);
}

.assignment-label {
  font-size: 0.9rem;
}

.assignment-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ------- PDF Modal ------- */

.pdf-modal {
  position: fixed;
  inset: 0;
  display: none; /* hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.pdf-modal.is-open {
  display: flex;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(6px);
}

.pdf-modal-content {
  position: relative;
  z-index: 1;
  width: min(1000px, 90vw);
  height: min(80vh, 700px);
  background: #020617;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.95);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pdf-modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 2;
  padding: 0.1rem 0.4rem;
}

.pdf-modal-close:hover {
  color: var(--accent);
}

.pdf-frame {
  border: none;
  width: 100%;
  height: 100%;
  margin-top: 0; /* ensure it fills content area */
}


  /* Depth / zoom effect by level */

  body[data-depth="1"] .main {
    transform: scale(1) translateY(0);
    transition: transform 260ms ease, box-shadow 260ms ease;
  }
  
  body[data-depth="2"] .main {
    transform: scale(0.98) translateY(4px);
  }
  
  body[data-depth="3"] .main {
    transform: scale(0.96) translateY(8px);
  }
  
  body[data-depth="4"] .main {
    transform: scale(0.94) translateY(12px);
  }

  body[data-depth="5"] .main {
    transform: scale(0.92) translateY(16px);
  }

  body[data-depth="6"] .main {
    transform: scale(0.90) translateY(20px);
  }

  
  /* Disable ALL transforms when PDF is open */
body.pdf-open *,
body.pdf-open .main,
body.pdf-open .level,
body.pdf-open #levels-container {
  transform: none !important;
  filter: none !important;
}

/* Ensure the embed renders crisp */
.pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ===== Front Page ===== */

.frontpage {
  display: flex;
  align-items: center;
  justify-content: center;
}

.frontpage-inner {
  max-width: 62rem;
  width: 100%;
  margin: auto;
  padding: 2rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.frontpage-header h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.frontpage-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.frontpage-statement,
.frontpage-guide {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem;
}

.frontpage-statement h3,
.frontpage-guide h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

.frontpage-statement p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.frontpage-guide ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.frontpage-guide li {
  margin: 0.4rem 0;
}

.frontpage-action {
  margin-top: 1.2rem;
}

/* Hide the topbar on the front page (Level 0) */
body[data-depth="0"] .topbar {
  display: none;
}

/* Give Level 0 more vertical space */
body[data-depth="0"] #levels-container {
  border: none;
  background: transparent;
}

body[data-depth="0"] .level.frontpage {
  padding: 0;
}

/* FRONT PAGE layout improvements */
body[data-depth="0"] .frontpage-inner{
  height: calc(100vh - 4rem);
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.2rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* statement becomes the main scroll area */
body[data-depth="0"] .frontpage-statement{
  flex: 1;
  overflow: auto;
  padding: 1.2rem 1.3rem;
}

/* make the button always visible */
body[data-depth="0"] .frontpage-action{
  position: sticky;
  bottom: 0;
  padding-top: 1rem;
  padding-bottom: 0.3rem;
  z-index: 5;
  background: linear-gradient(to top, rgba(5, 7, 22, 0.98), rgba(5, 7, 22, 0));
}

/* give the guide a normal height (not huge) */
body[data-depth="0"] .frontpage-guide{
  padding: 1.2rem 1.3rem;
}

/* nicer paragraph spacing inside the statement */
body[data-depth="0"] .frontpage-statement p{
  margin: 0 0 0.9rem;
  line-height: 1.65;
}
body[data-depth="0"] .frontpage-statement p:last-child{
  margin-bottom: 0;
}


/* Slight change in background intensity with depth */

body[data-depth="2"] {
  background:
    radial-gradient(circle at top left, rgba(94, 234, 212, 0.12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.22), transparent 55%),
    #020617;
}

body[data-depth="3"] {
  background:
    radial-gradient(circle at top left, rgba(94, 234, 212, 0.16), transparent 55%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.28), transparent 55%),
    #020617;
}

body[data-depth="4"] {
  background:
    radial-gradient(circle at top left, rgba(94, 234, 212, 0.2), transparent 55%),
    radial-gradient(circle at bottom right, rgba(129, 140, 248, 0.32), transparent 55%),
    #020617;
}
