/* =========================================================
   ROOT COLOURS AND GLOBAL THEME VARIABLES
   ========================================================= */

:root {
  --retro-bg: #08111f;
  --retro-surface: #101b2f;
  --retro-surface-2: #091525;
  --retro-border: #5f84b8;
  --retro-border-soft: #46658f;
  --retro-inner-border: #20314f;
  --retro-text: #a9d0ff;
  --retro-heading: #d7e9ff;
  --retro-link: #c9e2ff;

  --retro-accent: #c86bff;
  --retro-accent-soft: #ead8ff;
  --retro-accent-text: #12081f;
  --retro-accent-glow: rgba(200, 107, 255, 0.35);
  --retro-accent-glow-soft: rgba(200, 107, 255, 0.18);
  --retro-accent-tint: rgba(200, 107, 255, 0.12);
  --retro-accent-border-soft: rgba(200, 107, 255, 0.22);

  --retro-frame-line-1: rgba(200, 107, 255, 0.9);
  --retro-frame-line-2: rgba(234, 216, 255, 0.55);
  --retro-frame-shadow: rgba(200, 107, 255, 0.14);
}

.theme-level-home {
  --retro-accent: #c86bff;
  --retro-accent-soft: #ead8ff;
  --retro-accent-text: #12081f;
  --retro-accent-glow: rgba(200, 107, 255, 0.35);
  --retro-accent-glow-soft: rgba(200, 107, 255, 0.18);
  --retro-accent-tint: rgba(200, 107, 255, 0.12);
  --retro-accent-border-soft: rgba(200, 107, 255, 0.22);

  --retro-frame-line-1: rgba(200, 107, 255, 0.92);
  --retro-frame-line-2: rgba(234, 216, 255, 0.56);
  --retro-frame-shadow: rgba(200, 107, 255, 0.16);
}

.theme-level-1 {
  --retro-accent: #b868ff;
  --retro-accent-soft: #ead8ff;
  --retro-accent-text: #12081f;
  --retro-accent-glow: rgba(184, 104, 255, 0.35);
  --retro-accent-glow-soft: rgba(184, 104, 255, 0.18);
  --retro-accent-tint: rgba(184, 104, 255, 0.12);
  --retro-accent-border-soft: rgba(184, 104, 255, 0.22);

  --retro-frame-line-1: rgba(184, 104, 255, 0.9);
  --retro-frame-line-2: rgba(234, 216, 255, 0.52);
  --retro-frame-shadow: rgba(184, 104, 255, 0.14);
}

.theme-level-2 {
  --retro-accent: #ff5fa2;
  --retro-accent-soft: #ffd7e8;
  --retro-accent-text: #1a0811;
  --retro-accent-glow: rgba(255, 95, 162, 0.35);
  --retro-accent-glow-soft: rgba(255, 95, 162, 0.18);
  --retro-accent-tint: rgba(255, 95, 162, 0.12);
  --retro-accent-border-soft: rgba(255, 95, 162, 0.22);

  --retro-frame-line-1: rgba(255, 95, 162, 0.95);
  --retro-frame-line-2: rgba(255, 215, 232, 0.58);
  --retro-frame-shadow: rgba(255, 95, 162, 0.16);
}

.theme-level-3 {
  --retro-accent: #43e0ff;
  --retro-accent-soft: #d8f8ff;
  --retro-accent-text: #04151a;
  --retro-accent-glow: rgba(67, 224, 255, 0.35);
  --retro-accent-glow-soft: rgba(67, 224, 255, 0.18);
  --retro-accent-tint: rgba(67, 224, 255, 0.12);
  --retro-accent-border-soft: rgba(67, 224, 255, 0.22);

  --retro-frame-line-1: rgba(67, 224, 255, 0.96);
  --retro-frame-line-2: rgba(216, 248, 255, 0.6);
  --retro-frame-shadow: rgba(67, 224, 255, 0.16);
}

.theme-level-4 {
  --retro-accent: #9f7cff;
  --retro-accent-soft: #e8dcff;
  --retro-accent-text: #12081f;
  --retro-accent-glow: rgba(159, 124, 255, 0.34);
  --retro-accent-glow-soft: rgba(159, 124, 255, 0.17);
  --retro-accent-tint: rgba(159, 124, 255, 0.11);
  --retro-accent-border-soft: rgba(159, 124, 255, 0.2);

  --retro-frame-line-1: rgba(159, 124, 255, 0.94);
  --retro-frame-line-2: rgba(232, 220, 255, 0.56);
  --retro-frame-shadow: rgba(159, 124, 255, 0.14);
}

/* =========================================================
   MAIN PAGE CONTAINERS
   ========================================================= */

html {
  scroll-behavior: smooth;
}

#retro-homepage,
.retro-content-page {
  font-family: "Courier New", Courier, monospace;
  background: var(--retro-bg);
  color: var(--retro-text);
  border: 2px solid var(--retro-border);
  padding: 28px;
  max-width: 1200px;
  margin: 16px auto 0;
  box-shadow:
    inset 0 0 0 1px #1a2a42,
    0 0 18px rgba(120, 170, 255, 0.15);
  position: relative;
  overflow: hidden;
  animation: retroPageEnter 0.35s ease-out both;
}

/* Page entrance — complements the exit fade with a subtle "screen wake" feel */
@keyframes retroPageEnter {
  0% {
    opacity: 0;
    transform: translateY(4px);
    filter: brightness(1.08);
  }
  60% {
    opacity: 1;
    filter: brightness(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: brightness(1);
  }
}

/* Page exit fade — applied by JS before navigation */
.retro-page-exiting #retro-homepage,
.retro-page-exiting .retro-content-page {
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  opacity: 0;
  transform: translateY(-4px);
}

#retro-homepage::before,
.retro-content-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.18;
}

#retro-homepage > *,
.retro-content-page > * {
  position: relative;
  z-index: 1;
}

/* =========================================================
   RETRO THEME FRAME OVERLAY
   ========================================================= */

#retro-homepage.theme-level-home::after,
.retro-content-page.theme-level-home::after,
.retro-content-page.theme-level-1::after,
.retro-content-page.theme-level-2::after,
.retro-content-page.theme-level-3::after,
.retro-content-page.theme-level-4::after {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  border: 1px solid var(--retro-accent-border-soft);
  box-shadow: 0 0 8px var(--retro-accent-glow-soft);
}

/* =========================================================
   HOME THEME FRAME ANIMATION
   ========================================================= */

#retro-homepage.theme-level-home::after,
.retro-content-page.theme-level-home::after {
  background-image:
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 22%, transparent 36%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 64%, transparent 78%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 22%, transparent 36%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 64%, transparent 78%);
  background-repeat: no-repeat;
  background-size:
    220% 2px,
    220% 1px,
    2px 220%,
    1px 220%;
  background-position:
    -130% 0,
    130% 100%,
    0 -130%,
    100% 130%;
  animation: retroFrameHomeSweep 34s linear infinite;
}

/* =========================================================
   LEVEL 1 THEME FRAME ANIMATION
   Purple terminal drift
   ========================================================= */

.retro-content-page.theme-level-1::after {
  background-image:
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 24%, transparent 40%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 62%, transparent 76%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 24%, transparent 40%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 62%, transparent 76%),
    repeating-linear-gradient(
      180deg,
      transparent 0 19px,
      rgba(184, 104, 255, 0.06) 19px 20px,
      transparent 20px 38px
    );
  background-repeat: no-repeat;
  background-size:
    212% 2px,
    212% 1px,
    2px 212%,
    1px 212%,
    100% 100%;
  background-position:
    -120% 0,
    120% 100%,
    0 -120%,
    100% 120%,
    0 0;
  animation: retroFramePurpleDrift 36s ease-in-out infinite;
}

/* =========================================================
   LEVEL 2 THEME FRAME ANIMATION
   Pink neon pulse lanes
   ========================================================= */

.retro-content-page.theme-level-2::after {
  background-image:
    radial-gradient(circle at 18% 16%, rgba(255, 95, 162, 0.22) 0%, transparent 26%),
    radial-gradient(circle at 82% 84%, rgba(255, 215, 232, 0.12) 0%, transparent 28%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 28%, transparent 44%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 58%, transparent 72%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 28%, transparent 44%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 58%, transparent 72%);
  background-repeat: no-repeat;
  background-size:
    180px 180px,
    180px 180px,
    190% 2px,
    190% 1px,
    2px 190%,
    1px 190%;
  background-position:
    8% 10%,
    92% 90%,
    -108% 0,
    108% 100%,
    0 -108%,
    100% 108%;
  animation: retroFramePinkPulse 32s ease-in-out infinite;
}

/* =========================================================
   LEVEL 3 THEME FRAME ANIMATION
   True CRT/data monitor effect
   ========================================================= */

.retro-content-page.theme-level-3::after {
  background-image:
    linear-gradient(
      180deg,
      transparent 0%,
      rgba(67, 224, 255, 0.18) 47%,
      rgba(216, 248, 255, 0.42) 50%,
      rgba(67, 224, 255, 0.18) 53%,
      transparent 100%
    ),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    repeating-linear-gradient(
      90deg,
      transparent 0 18px,
      rgba(67, 224, 255, 0.08) 18px 19px,
      transparent 19px 34px
    ),
    repeating-linear-gradient(
      180deg,
      transparent 0 18px,
      rgba(67, 224, 255, 0.08) 18px 19px,
      transparent 19px 34px
    );
  background-repeat: no-repeat;
  background-size:
    100% 18%,
    240% 2px,
    240% 1px,
    2px 240%,
    1px 240%,
    100% 100%,
    100% 100%;
  background-position:
    0 -22%,
    -140% 0,
    140% 100%,
    0 -140%,
    100% 140%,
    0 0,
    0 0;
  animation: retroFrameCRTScan 38s linear infinite;
}

/* =========================================================
   LEVEL 4 THEME FRAME ANIMATION
   Purple arcade vector pulse
   ========================================================= */

.retro-content-page.theme-level-4::after {
  background-image:
    linear-gradient(135deg, transparent 0%, rgba(159, 124, 255, 0.14) 22%, transparent 38%),
    linear-gradient(315deg, transparent 0%, rgba(232, 220, 255, 0.1) 18%, transparent 34%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 20%, transparent 34%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 20%, transparent 34%),
    repeating-linear-gradient(
      90deg,
      transparent 0 26px,
      rgba(159, 124, 255, 0.06) 26px 27px,
      transparent 27px 54px
    );
  background-repeat: no-repeat;
  background-size:
    140% 140%,
    140% 140%,
    240% 2px,
    2px 240%,
    100% 100%;
  background-position:
    -16% -12%,
    116% 112%,
    -140% 100%,
    100% 140%,
    0 0;
  animation: retroFrameVectorPulse 34s ease-in-out infinite;
}

/* =========================================================
   HOME SCREEN
   ========================================================= */

#retro-homepage .retro-boot-screen {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 1.5rem 1.5rem;
  box-sizing: border-box;
}

#retro-homepage .retro-skip-intro {
  margin-top: auto;
  align-self: center;
  padding: 0.35rem 1.2rem !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.5px;
  opacity: 0;
  cursor: pointer;
  border-color: var(--retro-border-soft);
  background: transparent;
  color: var(--retro-text) !important;
  transition: opacity 0.4s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: skipIntroFadeIn 0.6s 1.2s ease forwards;
}

@keyframes skipIntroFadeIn {
  to { opacity: 0.55; }
}

#retro-homepage .retro-skip-intro:hover,
#retro-homepage .retro-skip-intro:focus {
  opacity: 1;
  border-color: var(--retro-accent);
  color: var(--retro-accent-soft) !important;
  background: var(--retro-accent-tint);
  box-shadow: 0 0 8px var(--retro-accent-glow-soft);
}

#retro-homepage #boot-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--retro-text);
}

#retro-homepage .retro-main-content {
  animation: retroMainReveal 0.45s ease-out;
}

/* =========================================================
   HERO SECTION
   ========================================================= */

#retro-homepage .retro-hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 0 1rem;
  text-align: center;
}

#retro-homepage .retro-hero h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

#retro-homepage .retro-hero__body {
  text-align: left;
  margin-bottom: 0.5rem;
}

#retro-homepage .retro-hero__body p {
  margin-bottom: 0.9rem;
}

#retro-homepage .retro-hero__body p:last-child {
  margin-bottom: 0;
}

#retro-homepage .retro-hero .retro-start-panel {
  margin-top: 2.5rem;
  margin-bottom: 0;
  padding: 2rem;
  border-color: var(--retro-accent-border-soft);
  background: var(--retro-surface-2);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
}

/* =========================================================
   TYPOGRAPHY
   ========================================================= */

#retro-homepage h1,
#retro-homepage h2,
#retro-homepage h3,
#retro-homepage h4,
#retro-homepage h5,
#retro-homepage h6,
.retro-content-page h1,
.retro-content-page h2,
.retro-content-page h3,
.retro-content-page h4,
.retro-content-page h5,
.retro-content-page h6 {
  font-family: "Courier New", Courier, monospace;
  color: var(--retro-heading);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  line-height: 1.2;
}

#retro-homepage h1,
.retro-content-page h1 {
  font-size: 3rem;
  margin-top: 0;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--retro-border-soft);
}

#retro-homepage h2,
.retro-content-page h2 {
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 12px;
}

#retro-homepage p,
#retro-homepage li,
#retro-homepage pre,
.retro-content-page p,
.retro-content-page li,
.retro-content-page pre {
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  line-height: 1.65;
}

#retro-homepage ul,
.retro-content-page ul {
  padding-left: 22px;
}

/* =========================================================
   PANELS
   ========================================================= */

#retro-homepage .retro-panel,
.retro-content-page .retro-panel {
  background: var(--retro-surface);
  border: 1px solid var(--retro-border-soft);
  padding: 18px;
  margin: 20px 0;
}

#retro-homepage a,
.retro-content-page a {
  color: var(--retro-link);
  font-weight: 700;
  font-size: inherit;
  font-family: "Courier New", Courier, monospace;
}

#retro-homepage a:hover,
#retro-homepage a:focus,
.retro-content-page a:hover,
.retro-content-page a:focus {
  color: #ffffff;
}

/* =========================================================
   BUTTONS
   ========================================================= */

#retro-homepage .retro-button,
.retro-content-page .retro-button {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 16px;
  background: var(--retro-accent-soft);
  color: var(--retro-accent-text) !important;
  border: 2px solid var(--retro-accent-soft);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Courier New", Courier, monospace;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

#retro-homepage .retro-button:hover,
#retro-homepage .retro-button:focus,
.retro-content-page .retro-button:hover,
.retro-content-page .retro-button:focus {
  background: var(--retro-accent);
  border-color: var(--retro-accent);
  color: var(--retro-accent-text) !important;
  text-decoration: none;
  box-shadow:
    0 0 8px var(--retro-accent-glow),
    0 0 18px var(--retro-accent-glow-soft);
  transform: translateY(-1px);
}

#retro-homepage .retro-button-pulse,
.retro-content-page .retro-button-pulse {
  font-size: 1.2rem;
  padding: 1rem 1.5rem;
  display: inline-block;
  min-width: 140px;
  text-align: center;
  animation: retroButtonPulse 3.8s ease-in-out infinite;
}

#retro-homepage .retro-button-pulse:hover,
#retro-homepage .retro-button-pulse:focus,
.retro-content-page .retro-button-pulse:hover,
.retro-content-page .retro-button-pulse:focus {
  animation-play-state: paused;
}

#retro-homepage img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 8px;
  border: 2px solid var(--retro-border);
}

/* =========================================================
   HOME START PANEL
   ========================================================= */

#retro-homepage .retro-start-panel {
  padding: 2rem;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#retro-homepage .retro-start-heading {
  margin-top: 0;
  margin-bottom: 1rem;
  text-align: center;
}

#retro-homepage .retro-logo-wrap {
  margin-top: 2.5rem;
  padding-top: 2rem;
  text-align: center;
  border-top: 1px solid var(--retro-inner-border);
}

#retro-homepage .retro-logo-image {
  max-width: 100%;
  height: auto;
  display: inline-block;
  border: none;
  margin-left: auto;
  margin-right: auto;
}

#retro-homepage .retro-logo-glitch {
  position: relative;
  display: inline-block;
}

#retro-homepage .retro-logo-glitch::before,
#retro-homepage .retro-logo-glitch::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background-image: var(--retro-logo-image);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  mix-blend-mode: screen;
}

#retro-homepage .retro-logo-glitch::before {
  filter: drop-shadow(6px 0 0 rgba(67, 224, 255, 0.55));
}

#retro-homepage .retro-logo-glitch::after {
  filter: drop-shadow(-6px 0 0 rgba(255, 95, 162, 0.5));
}

#retro-homepage .retro-logo-glitch.is-glitching::before {
  animation: retroLogoGlitchBefore 1.2s steps(6, end) infinite;
}

#retro-homepage .retro-logo-glitch.is-glitching::after {
  animation: retroLogoGlitchAfter 1.2s steps(6, end) infinite;
}

/* =========================================================
   CONTENT PAGES
   ========================================================= */

.retro-content-page[data-has-theme-selector="true"] {
  padding-top: 108px;
}

/* Make all frame animations static */
.retro-content-page::after {
  animation: none !important;
}

/* =========================================================
   THEME SELECTOR
   ========================================================= */

.retro-theme-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.retro-theme-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.72rem;
  border: 1px solid var(--retro-accent);
  border-radius: 0;
  background: rgba(8, 16, 34, 0.88);
  color: var(--retro-accent-soft);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.retro-theme-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.12) 42%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.12) 58%,
    transparent 65%,
    transparent 100%
  );
  pointer-events: none;
  transform: skewX(-18deg);
  transition: none;
}

.retro-theme-btn:hover::after {
  animation: retroKickerShine 1.2s ease-in-out infinite;
}

.retro-theme-btn:hover,
.retro-theme-btn:focus-visible {
  background: var(--retro-accent-tint);
  border-color: var(--retro-accent);
  box-shadow: 0 0 8px var(--retro-accent-glow-soft);
  outline: none;
}

.retro-theme-btn.is-open {
  border-color: var(--retro-accent);
  background: var(--retro-accent-tint);
}

/* Theme option panel — hidden by default */
.retro-theme-panel {
  display: none;
  flex-direction: row;
  gap: 0.35rem;
  align-items: center;
}

.retro-theme-panel.is-open {
  display: flex;
  animation: retroThemePanelReveal 0.25s ease-out;
}

@keyframes retroThemePanelReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.retro-theme-option {
  padding: 0.32rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.retro-theme-option--normal {
  background: rgba(8, 16, 34, 0.88);
  color: var(--retro-accent-soft);
}

.retro-theme-option--warm {
  background: #ffedbd;
  color: #121212;
}

.retro-theme-option--cool {
  background: #caf9fc;
  color: #121212;
}

.retro-theme-option:hover,
.retro-theme-option:focus-visible {
  border-color: var(--retro-accent);
  box-shadow: 0 0 6px var(--retro-accent-glow-soft);
  outline: none;
}

.retro-theme-option.is-selected {
  border-color: var(--retro-accent);
  box-shadow:
    0 0 0 2px var(--retro-accent),
    0 0 8px var(--retro-accent-glow-soft);
}

/* Subtle wash overlay when switching themes */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: rgba(255, 255, 255, 0);
  opacity: 0;
  transition: opacity 0.35s ease;
}

html.retro-theme-switching::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}

/* =========================================================
   ACCESSIBILITY MODE — LIGHT BACKGROUND WITH DARK TEXT
   Overrides the theme variables at root level so every
   element that reads --retro-text, --retro-link, etc.
   automatically gets a dark-on-light readable value.
   ========================================================= */

/* Smooth theme transitions */
body,
.retro-content-page,
#retro-homepage,
.navbar.fixed-top,
.navbar .dropdown-menu,
.retro-panel,
.retro-level-page,
.retro-content-kicker,
.retro-image-panel,
.retro-copy-item,
.retro-nav-tile__face,
.retro-flip-card__face {
  transition:
    background-color 0.45s ease,
    color 0.45s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}
@media (prefers-reduced-motion: reduce) {
  body,
  .retro-content-page,
  #retro-homepage,
  .navbar.fixed-top,
  .navbar .dropdown-menu,
  .retro-panel,
  .retro-level-page,
  .retro-content-kicker,
  .retro-image-panel,
  .retro-copy-item,
  .retro-nav-tile__face,
  .retro-flip-card__face {
    transition: none;
  }
}

/* Remap all theme variables to dark-on-light values.
   Must also override .theme-level-* which set accent vars
   on inner elements with higher specificity than :root. */
html.retro-a11y-active,
html.retro-a11y-active .theme-level-home,
html.retro-a11y-active .theme-level-1,
html.retro-a11y-active .theme-level-2,
html.retro-a11y-active .theme-level-3,
html.retro-a11y-active .theme-level-4 {
  --retro-bg: var(--retro-a11y-bg, #ffedbd);
  --retro-surface: var(--retro-a11y-bg, #ffedbd);
  --retro-surface-2: var(--retro-a11y-bg, #ffedbd);
  --retro-text: #1a1a1a;
  --retro-heading: #0e0e0e;
  --retro-link: #14406e;
  --retro-border: rgba(0, 0, 0, 0.22);
  --retro-border-soft: rgba(0, 0, 0, 0.15);
  --retro-inner-border: rgba(0, 0, 0, 0.08);
  --retro-accent: rgba(0, 0, 0, 0.7);
  --retro-accent-soft: #1a1a1a;
  --retro-accent-text: #f5f5f5;
  --retro-accent-glow: rgba(0, 0, 0, 0.06);
  --retro-accent-glow-soft: rgba(0, 0, 0, 0.03);
  --retro-accent-tint: rgba(0, 0, 0, 0.04);
  --retro-accent-border-soft: rgba(0, 0, 0, 0.12);
  --retro-frame-line-1: rgba(0, 0, 0, 0.12);
  --retro-frame-line-2: rgba(0, 0, 0, 0.06);
  --retro-frame-shadow: rgba(0, 0, 0, 0.04);
}

/* Background swap */
html.retro-a11y-active body {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  color: #1f1f1f !important;
}

html.retro-a11y-active #retro-homepage,
html.retro-a11y-active .retro-content-page {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  color: #1f1f1f !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

/* Panels — white tint for separation */
html.retro-a11y-active .retro-panel {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

/* Hide decorative overlays */
html.retro-a11y-active .retro-content-page::before,
html.retro-a11y-active .retro-content-page::after {
  display: none !important;
}

/* Force dark text on all content elements */
html.retro-a11y-active .retro-content-page,
html.retro-a11y-active .retro-content-page p,
html.retro-a11y-active .retro-content-page li,
html.retro-a11y-active .retro-content-page strong,
html.retro-a11y-active .retro-content-page pre,
html.retro-a11y-active .retro-content-subtitle,
html.retro-a11y-active .retro-step-indicator,
html.retro-a11y-active .retro-auto-strong,
html.retro-a11y-active .retro-level-page .retro-panel p strong,
html.retro-a11y-active .retro-level-page .retro-panel li strong {
  color: #1a1a1a !important;
  text-shadow: none !important;
}

/* Headings — strong dark, no glow */
html.retro-a11y-active .retro-content-page h1,
html.retro-a11y-active .retro-content-page h2,
html.retro-a11y-active .retro-content-page h3 {
  color: #0e0e0e !important;
  text-shadow: none !important;
  border-bottom-color: rgba(0, 0, 0, 0.18) !important;
}

/* Links — dark blue, bold, underlined */
html.retro-a11y-active .retro-content-page a,
html.retro-a11y-active #retro-homepage a,
html.retro-a11y-active .retro-level-page .retro-panel a {
  color: #14406e !important;
  font-weight: 700;
  text-decoration: underline !important;
}

/* Kicker badge */
html.retro-a11y-active .retro-content-kicker {
  color: #1a1a1a !important;
  background: rgba(0, 0, 0, 0.06) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

/* Level page outer border — remove purple accent */
html.retro-a11y-active .retro-level-page {
  border-color: rgba(0, 0, 0, 0.18) !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06) !important;
}

/* Video embed border */
html.retro-a11y-active .retro-level-page .retro-video-embed {
  border-color: rgba(0, 0, 0, 0.18) !important;
  box-shadow: none !important;
}

/* Buttons — inverted dark */
html.retro-a11y-active #retro-homepage .retro-button,
html.retro-a11y-active .retro-content-page .retro-button,
html.retro-a11y-active .retro-step-button,
html.retro-a11y-active .retro-copy-button {
  background: #222222 !important;
  color: #f5f5f5 !important;
  border-color: #222222 !important;
  box-shadow: none !important;
}

/* Sidebar / navbar */
html.retro-a11y-active .navbar.fixed-top,
html.retro-a11y-active .navbar.fixed-top > .container,
html.retro-a11y-active .navbar .dropdown-menu {
  background: var(--retro-a11y-bg, #ffedbd) !important;
}

html.retro-a11y-active .navbar.fixed-top {
  border-color: rgba(0, 0, 0, 0.15) !important;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06) !important;
}

html.retro-a11y-active .navbar-nav .nav-link,
html.retro-a11y-active .navbar .navbar-brand,
html.retro-a11y-active .navbar .dropdown-item,
html.retro-a11y-active .navbar-nav.ms-md-auto .nav-link {
  color: #1f1f1f !important;
}

html.retro-a11y-active .navbar-nav > .nav-item.dropdown > .dropdown-toggle {
  color: #444444 !important;
}

html.retro-a11y-active .navbar-nav .nav-link:hover,
html.retro-a11y-active .navbar .dropdown-item:hover,
html.retro-a11y-active .navbar .dropdown-item:focus {
  background: rgba(0, 0, 0, 0.07) !important;
}

html.retro-a11y-active .navbar-nav .nav-link.active,
html.retro-a11y-active .navbar .dropdown-item.active {
  background: rgba(0, 0, 0, 0.1) !important;
  border-left-color: #1f1f1f !important;
}

/* Image panels */
html.retro-a11y-active .retro-image-panel {
  background: rgba(255, 255, 255, 0.35) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
}

/* Copy item styling */
html.retro-a11y-active .retro-copy-item {
  border-color: rgba(0, 0, 0, 0.12) !important;
  background: rgba(255, 255, 255, 0.2) !important;
}

html.retro-a11y-active .retro-copy-item__text {
  color: #1f1f1f !important;
}

/* Search modal */
html.retro-a11y-active #mkdocs_search_modal .modal-content {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  color: #1f1f1f !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

html.retro-a11y-active #mkdocs_search_modal .modal-title {
  color: #111111 !important;
}

html.retro-a11y-active #mkdocs_search_modal .form-control {
  color: #1f1f1f !important;
  background: rgba(255, 255, 255, 0.45) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

html.retro-a11y-active #mkdocs-search-results a {
  color: #1a4480 !important;
}

html.retro-a11y-active #mkdocs-search-results p {
  color: #333333 !important;
}

/* Lightbox — match active a11y theme */
html.retro-a11y-active .global-lightbox {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

html.retro-a11y-active .global-lightbox__inner {
  border: 2px solid rgba(0, 0, 0, 0.3) !important;
  background: var(--retro-a11y-bg, #ffedbd) !important;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

html.retro-a11y-active .global-lightbox__inner::before {
  display: none !important;
}

html.retro-a11y-active .global-lightbox__media {
  border: 2px solid rgba(0, 0, 0, 0.2) !important;
  background: #ffffff !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important;
}

html.retro-a11y-active .global-lightbox__close {
  background: #222222 !important;
  color: #f5f5f5 !important;
  border-color: #222222 !important;
  box-shadow: none !important;
}

html.retro-a11y-active .global-lightbox__close:hover,
html.retro-a11y-active .global-lightbox__close:focus-visible {
  background: #000000 !important;
  color: #ffffff !important;
}

html.retro-a11y-active .global-lightbox__hint {
  color: #1a1a1a !important;
  text-shadow: none !important;
}

/* =========================================================
   ACCESSIBILITY MODE — TYPOGRAPHY & SPACING SCALE
   Increases font sizes, weights, spacing, and control
   readability. Only active when a11y mode is on.
   ========================================================= */

/* --- Content text: larger and bolder --- */
html.retro-a11y-active .retro-content-page p,
html.retro-a11y-active .retro-content-page li {
  font-size: 1.35rem !important;
  line-height: 1.85 !important;
  font-weight: 500 !important;
}

html.retro-a11y-active .retro-content-page h1 {
  font-size: 3.4rem !important;
  font-weight: 800 !important;
}

html.retro-a11y-active .retro-content-page h2 {
  font-size: 2rem !important;
  font-weight: 700 !important;
}

html.retro-a11y-active .retro-content-page h3 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
}

html.retro-a11y-active .retro-content-subtitle {
  font-size: 1.2rem !important;
  line-height: 1.7 !important;
}

html.retro-a11y-active .retro-content-kicker {
  font-size: 0.95rem !important;
  padding: 0.4rem 0.8rem !important;
}

html.retro-a11y-active .retro-step-indicator {
  font-size: 1rem !important;
  font-weight: 700 !important;
}

/* --- Sidebar nav: larger text with more spacing --- */
html.retro-a11y-active .navbar .navbar-brand {
  font-size: 0.95rem !important;
  padding: 1.1rem 1rem 0.9rem !important;
}

html.retro-a11y-active .navbar-nav > .nav-item > .nav-link {
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  padding: 0.6rem 1rem !important;
  line-height: 1.4 !important;
}

html.retro-a11y-active .navbar-nav > .nav-item.dropdown > .dropdown-toggle {
  font-size: 0.8rem !important;
  padding-top: 0.75rem !important;
  padding-bottom: 0.4rem !important;
}

html.retro-a11y-active .navbar .dropdown-item {
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 0.5rem 1rem 0.5rem 1.75rem !important;
  line-height: 1.4 !important;
}

html.retro-a11y-active .navbar-nav.ms-md-auto .nav-link {
  font-size: 0.8rem !important;
  opacity: 0.85 !important;
}

/* --- Buttons: larger, bolder text --- */
html.retro-a11y-active #retro-homepage .retro-button,
html.retro-a11y-active .retro-content-page .retro-button,
html.retro-a11y-active .retro-step-button {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  padding: 0.9rem 1.1rem !important;
}

html.retro-a11y-active .retro-copy-button {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  padding: 0.5rem 0.9rem !important;
}

/* --- Search modal text --- */
html.retro-a11y-active #mkdocs_search_modal .modal-title {
  font-size: 1.1rem !important;
}

html.retro-a11y-active #mkdocs_search_modal .form-control {
  font-size: 1rem !important;
}

html.retro-a11y-active #mkdocs-search-results a {
  font-size: 1rem !important;
  font-weight: 700 !important;
}

/* --- Hide Navigation toggle: fix dark-on-dark --- */
html.retro-a11y-active .retro-navbar-toggle {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1a1a1a !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
  box-shadow: none !important;
  font-size: 0.85rem !important;
  padding: 0.42rem 0.7rem !important;
}

html.retro-a11y-active .retro-navbar-toggle:hover,
html.retro-a11y-active .retro-navbar-toggle:focus-visible {
  background: rgba(0, 0, 0, 0.12) !important;
  border-color: rgba(0, 0, 0, 0.35) !important;
}

html.retro-a11y-active .retro-navbar-toggle.is-hidden-state {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #333333 !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
}

html.retro-a11y-active .retro-navbar-toggle__state {
  border-color: rgba(0, 0, 0, 0.2) !important;
  background: rgba(0, 0, 0, 0.04) !important;
}

/* --- Theme selector: readable in warm/cool modes --- */
html.retro-a11y-active .retro-theme-btn {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #1a1a1a !important;
  border-color: rgba(0, 0, 0, 0.25) !important;
  font-size: 0.85rem !important;
}

html.retro-a11y-active .retro-theme-btn:hover {
  background: rgba(0, 0, 0, 0.12) !important;
}

html.retro-a11y-active .retro-theme-option {
  border-color: rgba(0, 0, 0, 0.2) !important;
}

html.retro-a11y-active .retro-theme-option.is-selected {
  border-color: #1a1a1a !important;
  box-shadow: 0 0 0 2px #1a1a1a !important;
}

html.retro-a11y-active .retro-theme-option--normal {
  background: rgba(8, 16, 34, 0.85) !important;
  color: #d0deff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* --- Next Level transition: a11y-mode colour fixes ---
   The overlay is always dark, so we need bright text/bars
   that contrast against the near-black background. Use a
   palette-aware accent for each mode. */

html[data-retro-theme="warm"] .retro-transition {
  --retro-a11y-tr-accent: #dab264;
  --retro-a11y-tr-glow: rgba(218, 178, 100, 0.3);
  --retro-a11y-tr-glow-soft: rgba(218, 178, 100, 0.15);
  --retro-a11y-tr-text: #f0e0b8;
  --retro-a11y-tr-tint: rgba(218, 178, 100, 0.08);
}

html[data-retro-theme="cool"] .retro-transition {
  --retro-a11y-tr-accent: #64d2e1;
  --retro-a11y-tr-glow: rgba(100, 210, 225, 0.3);
  --retro-a11y-tr-glow-soft: rgba(100, 210, 225, 0.15);
  --retro-a11y-tr-text: #c0ecf2;
  --retro-a11y-tr-tint: rgba(100, 210, 225, 0.08);
}

html.retro-a11y-active .retro-transition {
  background:
    radial-gradient(circle at center, var(--retro-a11y-tr-tint, rgba(0,0,0,0.05)) 0%, rgba(0, 0, 0, 0.96) 78%),
    rgba(0, 0, 0, 0.95) !important;
}

html.retro-a11y-active .retro-transition__terminal {
  color: var(--retro-a11y-tr-text, #e0e0e0) !important;
  border-color: var(--retro-a11y-tr-accent, #ccc) !important;
  box-shadow:
    inset 0 0 0 1px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)),
    0 0 18px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.08)) !important;
  background:
    linear-gradient(180deg, rgba(6, 10, 22, 0.98), rgba(2, 6, 16, 0.99)) !important;
}

html.retro-a11y-active .retro-transition__terminal-title {
  color: var(--retro-a11y-tr-text, #e0e0e0) !important;
  opacity: 0.85;
}

html.retro-a11y-active .retro-transition__terminal-text {
  color: var(--retro-a11y-tr-accent, #ccc) !important;
  text-shadow:
    0 0 8px var(--retro-a11y-tr-glow, rgba(255,255,255,0.2)),
    0 0 18px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)) !important;
}

html.retro-a11y-active .retro-transition__loading-bar {
  border-color: var(--retro-a11y-tr-accent, #ccc) !important;
  background: rgba(6, 11, 24, 0.95) !important;
  box-shadow:
    inset 0 0 0 1px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)),
    0 0 10px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.08)) !important;
}

html.retro-a11y-active .retro-transition__loading-fill {
  background: var(--retro-a11y-tr-accent, #ccc) !important;
  box-shadow:
    0 0 10px var(--retro-a11y-tr-glow, rgba(255,255,255,0.2)),
    0 0 16px var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)) !important;
}

html.retro-a11y-active .retro-transition__loading-meta {
  color: var(--retro-a11y-tr-text, #e0e0e0) !important;
}

html.retro-a11y-active .retro-transition__scanlines {
  opacity: 0.15 !important;
}

html.retro-a11y-active .retro-transition__grid {
  background-image:
    linear-gradient(var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)) 1px, transparent 1px),
    linear-gradient(90deg, var(--retro-a11y-tr-glow-soft, rgba(255,255,255,0.1)) 1px, transparent 1px) !important;
}

/* --- Rotatable tiles: a11y readability + consistent sizing ---
   Gives tile faces a solid light background with dark, readable
   text. Fixed aspect-ratio keeps every tile the same size
   regardless of content length. Fully opaque backgrounds
   prevent text bleed-through during the flip animation.
   Only scoped to a11y mode — normal theme is unchanged. */

/* Solid light backgrounds, consistent sizing, no bleed-through */
html.retro-a11y-active .retro-nav-tile__face {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1px 4px rgba(0, 0, 0, 0.08) !important;
  color: #1a1a1a !important;
  min-height: 0 !important;
  height: 100% !important;
  aspect-ratio: 4 / 3;
}

html.retro-a11y-active .retro-nav-tile__front {
  overflow: hidden;
}

html.retro-a11y-active .retro-nav-tile__back {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  overflow: auto;
}

/* Remove decorative scanline overlay and inner glow */
html.retro-a11y-active .retro-nav-tile__front::before {
  display: none !important;
}

html.retro-a11y-active .retro-nav-tile__front::after,
html.retro-a11y-active .retro-nav-tile__back::after {
  box-shadow: none !important;
}

/* Dark, readable text — scaled down so it fits the fixed aspect-ratio */
html.retro-a11y-active .retro-nav-tile__front h3 {
  color: #0e0e0e !important;
  text-shadow: none !important;
  font-size: 1.25rem !important;
}

html.retro-a11y-active .retro-nav-tile__back p,
html.retro-a11y-active .retro-nav-tile__back li {
  color: #1a1a1a !important;
  text-shadow: none !important;
  font-size: 0.95rem !important;
  line-height: 1.55 !important;
}

html.retro-a11y-active .retro-nav-tile__back strong {
  color: #0e0e0e !important;
}

/* Back-face link/button */
html.retro-a11y-active .retro-nav-tile__back .retro-button {
  background: #222222 !important;
  color: #f5f5f5 !important;
  border-color: #222222 !important;
}

/* --- Same treatment for calendar-events flip cards --- */
html.retro-a11y-active .retro-flip-card__face {
  background: var(--retro-a11y-bg, #ffedbd) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 1px 4px rgba(0, 0, 0, 0.08) !important;
  color: #1a1a1a !important;
}

html.retro-a11y-active .retro-flip-card__front::before {
  display: none !important;
}

html.retro-a11y-active .retro-flip-card__front::after,
html.retro-a11y-active .retro-flip-card__back::after {
  box-shadow: none !important;
}

html.retro-a11y-active .retro-flip-card__front h4 {
  color: #0e0e0e !important;
  text-shadow: none !important;
}

html.retro-a11y-active .retro-flip-card__back {
  background: var(--retro-a11y-bg, #ffedbd) !important;
}

html.retro-a11y-active .retro-flip-card__back li,
html.retro-a11y-active .retro-flip-card__back p {
  color: #1a1a1a !important;
  text-shadow: none !important;
}

html.retro-a11y-active .retro-flip-card__back strong {
  color: #0e0e0e !important;
}

/* =========================================================
   NAVBAR TOGGLE
   ========================================================= */

.retro-navbar-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.38rem 0.62rem;
  border: 1px solid var(--retro-accent);
  border-radius: 0;
  background: rgba(8, 16, 34, 0.88);
  color: var(--retro-accent-soft);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--retro-accent-border-soft);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.retro-navbar-toggle::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.12) 42%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.12) 58%,
    transparent 65%,
    transparent 100%
  );
  pointer-events: none;
  transform: skewX(-18deg);
  transition: none;
}

.retro-navbar-toggle:hover::after {
  animation: retroKickerShine 1.2s ease-in-out infinite;
}

.retro-navbar-toggle:hover,
.retro-navbar-toggle:focus-visible {
  background: var(--retro-accent-tint);
  border-color: var(--retro-accent);
  box-shadow:
    inset 0 0 0 1px var(--retro-accent-border-soft),
    0 0 10px var(--retro-accent-glow-soft);
  outline: none;
}

.retro-navbar-toggle:active {
  transform: translateY(1px);
}

.retro-navbar-toggle__text {
  display: inline-block;
}

.retro-navbar-toggle__state {
  min-width: 3.2rem;
  padding: 0.22rem 0.34rem;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  line-height: 1;
}

.retro-navbar-toggle.is-hidden-state {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(8, 12, 22, 0.92);
  color: #d6deef;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.retro-navbar-toggle.is-hidden-state .retro-navbar-toggle__state {
  background: rgba(255, 255, 255, 0.06);
}

/* ---- Nav boot-in staggered reveal ---- */
@keyframes retroNavBootIn {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  60% {
    opacity: 1;
    transform: translateX(2px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.retro-nav-booting .navbar-nav .nav-link,
.retro-nav-booting .navbar-nav .dropdown-item {
  animation: retroNavBootIn 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--nav-i, 0) * 28ms);
}

.retro-nav-booting .navbar-brand {
  animation: retroNavBootIn 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---- Nav power-down staggered exit ---- */
@keyframes retroNavPowerDown {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-8px);
  }
}

.retro-nav-powering-down .navbar-nav .nav-link,
.retro-nav-powering-down .navbar-nav .dropdown-item {
  animation: retroNavPowerDown 0.12s cubic-bezier(0.55, 0, 1, 0.45) both;
  animation-delay: calc(var(--nav-i, 0) * 18ms);
}

.retro-nav-powering-down .navbar-brand {
  animation: retroNavPowerDown 0.1s cubic-bezier(0.55, 0, 1, 0.45) both;
  animation-delay: calc(var(--nav-total, 0) * 18ms);
}

/* Hide/show for sidebar and bs-sidebar are now handled
   inside the desktop/mobile media queries in the sidebar section below. */

html.retro-navbar-hidden .bs-sidebar {
  display: none;
}

.retro-content-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.retro-content-header {
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.retro-content-shell > .retro-panel:not(.retro-video-panel) {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.retro-content-kicker {
  display: inline-block;
  position: relative;
  margin-bottom: 0.8rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--retro-accent);
  color: var(--retro-accent-soft);
  background: var(--retro-accent-tint);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.88rem;
  cursor: default;
  overflow: hidden;
}

/* Reflective glint sweep on Level badge hover */
.retro-content-kicker::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 35%,
    rgba(255, 255, 255, 0.12) 42%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.12) 58%,
    transparent 65%,
    transparent 100%
  );
  pointer-events: none;
  transform: skewX(-18deg);
  transition: none;
}

.retro-content-kicker:hover::after {
  animation: retroKickerShine 1.2s ease-in-out infinite;
}

@keyframes retroKickerShine {
  0% {
    left: -100%;
  }
  100% {
    left: 200%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .retro-content-kicker:hover::after,
  .retro-theme-btn:hover::after,
  .retro-navbar-toggle:hover::after {
    animation: none;
  }
}

.retro-content-subtitle {
  margin-top: 0.75rem;
  color: #cfe4ff;
  font-size: 1.15rem;
  line-height: 1.65;
}

.retro-content-footer {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.retro-content-page p,
.retro-content-page li {
  font-size: 1.25rem;
  line-height: 1.78;
}

.retro-content-page h1 {
  font-size: 3.2rem;
}

.retro-content-page h2 {
  font-size: 1.85rem;
}

/* =========================================================
   TERMINOLOGY PAGE — READABILITY ENHANCEMENTS
   ========================================================= */

/* Section panels get a bit more internal room */
.retro-term-section {
  padding: 24px 22px !important;
}

/* Intro text below section h2 — subtle separator from entries */
.retro-term-section-intro {
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--retro-inner-border);
}

/* Individual term entry cards */
.retro-term-entry {
  position: relative;
  margin-top: 1.1rem;
  padding: 1rem 1.15rem 1rem 1.15rem;
  border: 1px solid var(--retro-inner-border);
  border-left: 3px solid var(--retro-accent-soft);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.02);
}

.retro-term-entry + .retro-term-entry {
  margin-top: 0.85rem;
}

/* Term title — make it pop */
.retro-term-entry h3 {
  font-size: 1.15rem;
  margin-top: 0;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--retro-inner-border);
  letter-spacing: 0.1em;
}

/* Better paragraph spacing inside entries */
.retro-term-entry p {
  margin-bottom: 0.7rem;
}

.retro-term-entry p:last-child,
.retro-term-entry ul:last-child {
  margin-bottom: 0;
}

.retro-term-entry ul {
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
}

/* "Important" callout notes */
.retro-term-note {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--retro-accent-soft);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
}

.retro-term-note p:first-child {
  margin-top: 0;
}

.retro-term-note p:last-child,
.retro-term-note ul:last-child {
  margin-bottom: 0;
}

/* --- Warm / Cool theme overrides --- */
html.retro-a11y-active .retro-term-entry {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(0, 0, 0, 0.1);
  border-left-color: rgba(0, 0, 0, 0.35);
}

html.retro-a11y-active .retro-term-entry h3 {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

html.retro-a11y-active .retro-term-note {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.22);
}

html.retro-a11y-active .retro-term-section-intro {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Responsive — tighter on mobile */
@media (max-width: 600px) {
  .retro-term-entry {
    padding: 0.8rem 0.85rem;
  }

  .retro-term-note {
    padding: 0.7rem 0.8rem;
  }

  .retro-term-entry h3 {
    font-size: 1.05rem;
  }
}

/* =========================================================
   VIDEO
   ========================================================= */

.retro-video-panel {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding: 22px;
  text-align: center;
}

.retro-video-panel h2 {
  margin-bottom: 1rem;
}

.retro-video-embed {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--retro-accent);
  background: #050b14;
  box-shadow:
    inset 0 0 0 1px var(--retro-accent-border-soft),
    0 0 16px var(--retro-accent-glow-soft);
  overflow: hidden;
}

.retro-video-embed::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.18;
}

.retro-video-embed iframe {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* =========================================================
   BOOT REVEAL
   ========================================================= */

.retro-reveal {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  display: none;
  overflow: hidden;
  background:
    radial-gradient(circle at center, var(--retro-accent-tint) 0%, rgba(8, 17, 31, 0.96) 70%),
    rgba(8, 17, 31, 0.92);
}

.retro-reveal.is-active {
  display: block;
  opacity: 1;
}

.retro-reveal__flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.92) 0%,
    var(--retro-accent-tint) 22%,
    rgba(255, 255, 255, 0) 70%
  );
}

.retro-reveal__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  opacity: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    var(--retro-accent) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  box-shadow:
    0 0 10px var(--retro-accent-glow),
    0 0 24px var(--retro-accent-glow-soft);
}

.retro-reveal__text {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  opacity: 0;
  white-space: nowrap;
  color: var(--retro-accent-soft);
  font-size: clamp(0.95rem, 2vw, 1.35rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow:
    0 0 8px var(--retro-accent-glow),
    0 0 18px var(--retro-accent-glow-soft);
}

.retro-reveal.is-playing .retro-reveal__flash {
  animation: retroRevealFlash 0.75s ease-out forwards;
}

.retro-reveal.is-playing .retro-reveal__line {
  animation: retroRevealLine 0.8s ease-out forwards;
}

.retro-reveal.is-playing .retro-reveal__text {
  animation: retroRevealText 0.95s ease-out forwards;
}

/* =========================================================
   PAGE TRANSITION
   ========================================================= */

.retro-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at center, var(--retro-accent-tint) 0%, rgba(0, 0, 0, 0.96) 78%),
    rgba(0, 0, 0, 0.95);
  transition: opacity 0.2s ease;
}

.retro-transition.is-active {
  opacity: 1;
}

.retro-transition__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 2px,
    transparent 2px,
    transparent 5px
  );
  mix-blend-mode: screen;
  opacity: 0.25;
  animation: retroScanlineScroll 0.18s linear infinite;
}

.retro-transition__grid {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    linear-gradient(var(--retro-accent-border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--retro-accent-border-soft) 1px, transparent 1px);
  background-size: 42px 42px;
  transform: perspective(900px) rotateX(72deg) scale(1.4);
  transform-origin: center bottom;
}

.retro-transition__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.95) 0%,
    var(--retro-accent-tint) 20%,
    rgba(255, 255, 255, 0) 52%
  );
  opacity: 0;
}

.retro-transition__beam {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140vw;
  height: 140vw;
  transform: translate(-50%, -50%) scale(0.05);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    var(--retro-accent) 0%,
    var(--retro-accent-tint) 18%,
    rgba(255, 255, 255, 0) 60%
  );
  opacity: 0;
  filter: blur(4px);
}

.retro-transition__stars {
  position: absolute;
  inset: -20%;
  opacity: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 1px, transparent 1.5px),
    radial-gradient(circle, var(--retro-accent) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.7) 1px, transparent 1.5px);
  background-size: 120px 120px, 180px 180px, 240px 240px;
  background-position: 0 0, 40px 60px, 100px 20px;
  transform: scale(0.8);
}

.retro-transition__terminal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 40px));
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  padding: 1rem 1.2rem;
  border: 2px solid var(--retro-accent);
  background: rgba(8, 12, 24, 0.92);
  box-shadow:
    0 0 18px var(--retro-accent-glow-soft),
    inset 0 0 0 1px var(--retro-accent-border-soft);
  color: var(--retro-accent-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.retro-transition__terminal-title {
  font-size: 0.85rem;
  margin-bottom: 0.7rem;
  opacity: 0.8;
}

.retro-transition__terminal-text {
  font-size: clamp(1rem, 2vw, 1.4rem);
  text-shadow:
    0 0 8px var(--retro-accent-glow),
    0 0 18px var(--retro-accent-glow-soft);
}

.retro-transition__loading {
  margin-top: 0.9rem;
}

.retro-transition__loading-bar {
  position: relative;
  height: 14px;
  overflow: hidden;
  border: 2px solid var(--retro-accent);
  background: rgba(6, 11, 24, 0.95);
  box-shadow:
    inset 0 0 0 1px var(--retro-accent-border-soft),
    0 0 10px var(--retro-accent-glow-soft);
}

.retro-transition__loading-fill {
  width: var(--retro-load-progress, 0%);
  height: 100%;
  background: var(--retro-accent);
  box-shadow:
    0 0 10px var(--retro-accent-glow),
    0 0 16px var(--retro-accent-glow-soft);
  transition: width 0.12s steps(3, end);
}

.retro-transition__loading-meta {
  margin-top: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.11em;
  opacity: 0.88;
}

.retro-transition__loading-status::after {
  content: "_";
  display: inline-block;
  margin-left: 0.2rem;
  animation: retroCursorBlink 0.85s step-end infinite;
}

.retro-transition.is-playing .retro-transition__flash {
  animation: retroFlashBurst 0.45s ease-out forwards;
}

.retro-transition.is-playing .retro-transition__grid {
  animation: retroGridRise 1.05s ease-out forwards;
}

.retro-transition.is-playing .retro-transition__terminal {
  animation: retroTerminalAppear 0.9s ease-out forwards;
}

.retro-transition.is-playing .retro-transition__loading-bar {
  animation: retroLoadingBarHum 0.95s ease-in-out infinite;
}

.retro-transition.is-playing .retro-transition__beam {
  animation: retroBeamWarp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.retro-transition.is-playing .retro-transition__stars {
  animation: retroStarsRush 1.1s ease-in forwards;
}

/* =========================================================
   GLOBAL LIGHTBOX AREA
   ========================================================= */

.global-lightbox-target {
  cursor: zoom-in;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    opacity 0.18s ease;
}

.global-lightbox-target:hover,
.global-lightbox-target:focus-visible {
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 0 0 2px rgba(200, 107, 255, 0.45),
    0 0 18px rgba(200, 107, 255, 0.28);
  filter: brightness(1.03);
}

.global-lightbox {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(35, 18, 70, 0.45) 0%, rgba(0, 0, 18, 0.92) 55%, rgba(0, 0, 10, 0.97) 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 2rem;
  backdrop-filter: blur(4px);
}

.global-lightbox.is-open {
  display: flex;
}

.global-lightbox__inner {
  position: relative;
  width: min(95vw, 1400px);
  max-height: 92vh;
  border: 2px solid #c084fc;
  box-shadow:
    0 0 25px rgba(192, 132, 252, 0.45),
    0 0 50px rgba(192, 132, 252, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 18px 18px 14px;
  background:
    linear-gradient(180deg, rgba(15, 10, 35, 0.98), rgba(8, 8, 24, 0.98));
  overflow: hidden;
}

.global-lightbox__inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0px,
    rgba(255, 255, 255, 0.035) 1px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.2;
}

.global-lightbox__media {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 72vh;
  display: block;
  margin: 0 auto;
  border: 2px solid rgba(192, 132, 252, 0.75);
  background: #050814;
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.18);
}

.global-lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  background: rgba(20, 12, 40, 0.95);
  border: 2px solid #c084fc;
  color: #f2e8ff;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.global-lightbox__close:hover,
.global-lightbox__close:focus-visible {
  background: #c084fc;
  color: #12081f;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.35);
  transform: translateY(-1px);
  outline: none;
}

.global-lightbox__hint {
  position: relative;
  z-index: 1;
  text-align: center;
  margin: 14px 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e8d8ff;
  opacity: 0.9;
}

/* =========================================================
   RETRO THEME ANIMATIONS
   ========================================================= */

@keyframes retroFrameHomeSweep {
  0% {
    background-position:
      -130% 0,
      130% 100%,
      0 -130%,
      100% 130%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      115% 0,
      -115% 100%,
      0 115%,
      100% -115%;
    opacity: 0.88;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 14px var(--retro-accent-glow-soft);
  }

  100% {
    background-position:
      -130% 0,
      130% 100%,
      0 -130%,
      100% 130%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFrameTerminalFlicker {
  0% {
    background-position:
      -120% 0,
      120% 100%,
      0 -120%,
      100% 120%;
    opacity: 0.76;
  }

  20% {
    opacity: 0.8;
  }

  21% {
    opacity: 0.73;
  }

  22% {
    opacity: 0.81;
  }

  50% {
    background-position:
      95% 0,
      -95% 100%,
      0 95%,
      100% -95%;
    opacity: 0.84;
  }

  72% {
    opacity: 0.76;
  }

  73% {
    opacity: 0.82;
  }

  100% {
    background-position:
      -120% 0,
      120% 100%,
      0 -120%,
      100% 120%;
    opacity: 0.76;
  }
}

@keyframes retroFrameNeonChase {
  0% {
    background-position:
      -105% 0,
      105% 100%,
      0 -105%,
      100% 105%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      100% 0,
      -100% 100%,
      0 100%,
      100% -100%;
    opacity: 0.9;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 16px var(--retro-accent-glow-soft);
  }

  100% {
    background-position:
      -105% 0,
      105% 100%,
      0 -105%,
      100% 105%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFrameCRTScan {
  0% {
    background-position:
      0 -22%,
      -140% 0,
      140% 100%,
      0 -140%,
      100% 140%,
      0 0,
      0 0;
    opacity: 0.76;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  45% {
    opacity: 0.8;
  }

  50% {
    background-position:
      0 108%,
      -40% 0,
      40% 100%,
      0 -40%,
      100% 40%,
      22px 0,
      0 22px;
    opacity: 0.92;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 16px var(--retro-accent-glow-soft);
  }

  100% {
    background-position:
      0 -22%,
      -140% 0,
      140% 100%,
      0 -140%,
      100% 140%,
      44px 0,
      0 44px;
    opacity: 0.76;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFramePinkPulse {
  0%, 100% {
    background-position:
      8% 10%,
      92% 90%,
      -108% 0,
      108% 100%,
      0 -108%,
      100% 108%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      14% 14%,
      86% 86%,
      96% 0,
      -96% 100%,
      0 96%,
      100% -96%;
    opacity: 0.9;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 18px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFramePurpleDrift {
  0%, 100% {
    background-position:
      -120% 0,
      120% 100%,
      0 -120%,
      100% 120%,
      0 0;
    opacity: 0.76;
  }

  48% {
    background-position:
      90% 0,
      -90% 100%,
      0 90%,
      100% -90%,
      0 18px;
    opacity: 0.84;
  }

  52% {
    opacity: 0.78;
  }
}

@keyframes retroFrameVectorPulse {
  0%, 100% {
    background-position:
      -16% -12%,
      116% 112%,
      -140% 100%,
      100% 140%,
      0 0;
    opacity: 0.76;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      -8% -6%,
      108% 106%,
      96% 100%,
      100% -96%,
      18px 0;
    opacity: 0.88;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 16px var(--retro-accent-glow-soft);
  }
}

@keyframes retroLogoGlitchBefore {
  0%, 100% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  5%  { opacity: 0.55; transform: translateX(6px); clip-path: inset(4% 0 68% 0); }
  10% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  18% { opacity: 0.45; transform: translateX(-8px); clip-path: inset(22% 0 48% 0); }
  24% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  35% { opacity: 0.5; transform: translateX(5px); clip-path: inset(40% 0 28% 0); }
  41% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  52% { opacity: 0.4; transform: translateX(-7px); clip-path: inset(56% 0 18% 0); }
  57% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  68% { opacity: 0.35; transform: translateX(4px); clip-path: inset(72% 0 8% 0); }
  73% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  84% { opacity: 0.3; transform: translateX(-5px); clip-path: inset(86% 0 2% 0); }
  89% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
}

@keyframes retroLogoGlitchAfter {
  0%, 100% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  3%  { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  8%  { opacity: 0.5; transform: translateX(-6px); clip-path: inset(10% 0 62% 0); }
  14% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  22% { opacity: 0.45; transform: translateX(7px); clip-path: inset(30% 0 38% 0); }
  28% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  38% { opacity: 0.5; transform: translateX(-5px); clip-path: inset(48% 0 22% 0); }
  44% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  55% { opacity: 0.4; transform: translateX(8px); clip-path: inset(62% 0 14% 0); }
  60% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  72% { opacity: 0.35; transform: translateX(-4px); clip-path: inset(78% 0 6% 0); }
  77% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
  88% { opacity: 0.25; transform: translateX(5px); clip-path: inset(90% 0 0 0); }
  92% { opacity: 0; transform: translateX(0); clip-path: inset(0 0 0 0); }
}

@keyframes retroCursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes retroLoadingBarHum {
  0%, 100% { box-shadow: inset 0 0 0 1px var(--retro-accent-border-soft), 0 0 8px var(--retro-accent-glow-soft); }
  50% { box-shadow: inset 0 0 0 1px var(--retro-accent-border-soft), 0 0 14px var(--retro-accent-glow); }
}

@keyframes retroMainReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes retroRevealFlash {
  0% {
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes retroRevealLine {
  0% {
    opacity: 0;
    transform: scaleX(0.15);
  }

  35% {
    opacity: 1;
    transform: scaleX(1);
  }

  100% {
    opacity: 0;
    transform: scaleX(1);
  }
}

@keyframes retroRevealText {
  0% {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.96);
    filter: blur(4px);
  }

  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }

  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(1.04);
  }
}

@keyframes retroScanlineScroll {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(6px);
  }
}

@keyframes retroFlashBurst {
  0% {
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes retroGridRise {
  0% {
    opacity: 0;
    transform: perspective(900px) rotateX(72deg) translateY(60px) scale(1.45);
  }

  25% {
    opacity: 0.45;
  }

  100% {
    opacity: 0;
    transform: perspective(900px) rotateX(72deg) translateY(-40px) scale(1.05);
  }
}

@keyframes retroTerminalAppear {
  0% {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.92);
    filter: blur(4px);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }

  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(1.04);
  }
}

@keyframes retroBeamWarp {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.05);
  }

  20% {
    opacity: 0.7;
  }

  55% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.25);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.8);
  }
}

@keyframes retroStarsRush {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: blur(0);
  }

  20% {
    opacity: 0.55;
  }

  100% {
    opacity: 0;
    transform: scale(1.8);
    filter: blur(2px);
  }
}

@keyframes retroButtonPulse {
  0% {
    background: var(--retro-accent-soft);
    border-color: var(--retro-accent-soft);
    color: var(--retro-accent-text) !important;
    box-shadow:
      0 0 0 rgba(255, 255, 255, 0),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background: var(--retro-accent);
    border-color: var(--retro-accent);
    color: var(--retro-accent-text) !important;
    box-shadow:
      0 0 10px var(--retro-accent-glow),
      0 0 18px var(--retro-accent-glow-soft);
  }

  100% {
    background: var(--retro-accent-soft);
    border-color: var(--retro-accent-soft);
    color: var(--retro-accent-text) !important;
    box-shadow:
      0 0 0 rgba(255, 255, 255, 0),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {
  #retro-homepage,
  .retro-content-page {
    padding: 18px;
  }

  .retro-content-page[data-has-theme-selector="true"] {
    padding-top: 100px;
  }

  .retro-theme-controls {
    top: 14px;
    right: 14px;
  }

  .retro-theme-btn {
    gap: 0.35rem;
    padding: 0.3rem 0.44rem;
    font-size: 0.64rem;
  }

  .retro-theme-option {
    padding: 0.24rem 0.42rem;
    font-size: 0.58rem;
  }

  .retro-navbar-toggle {
    gap: 0.45rem;
    padding: 0.34rem 0.52rem;
    font-size: 0.68rem;
  }

  .retro-navbar-toggle__state {
    min-width: 2.8rem;
  }

  #retro-homepage h1,
  .retro-content-page h1 {
    font-size: 2.2rem;
  }

  .retro-content-page p,
  .retro-content-page li {
    font-size: 1.1rem;
    line-height: 1.72;
  }

  .retro-content-page h2 {
    font-size: 1.5rem;
  }

  .retro-video-panel {
    padding: 16px;
  }

  .global-lightbox {
    padding: 1rem;
  }

  .global-lightbox__inner {
    padding: 14px 14px 12px;
  }

  .global-lightbox__media {
    max-height: 68vh;
  }

  .global-lightbox__close {
    top: 10px;
    right: 10px;
    padding: 0.42rem 0.65rem;
  }

  .global-lightbox__hint {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }
}

/* =========================================================
   SHARED COMPONENTS
   ========================================================= */

.retro-image-panel img.retro-inline-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.retro-image-panel img.retro-inline-image[data-lightbox],
.retro-lightbox-target {
  cursor: zoom-in;
}

.retro-section-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  flex-wrap: wrap;
}

.retro-section-nav__link {
  flex: 0 1 220px;
  min-width: 220px;
  text-align: center;
  margin-top: 0 !important;
}

/* =========================================================
   SHARED LIGHTBOX
   ========================================================= */

.global-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(4, 8, 24, 0.92);
  backdrop-filter: blur(4px);
}

.global-lightbox.is-open {
  display: flex;
}

.global-lightbox__inner {
  width: min(96vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  position: relative;
  border: 2px solid #c86bff;
  background: linear-gradient(180deg, rgba(22, 10, 46, 0.98), rgba(8, 4, 24, 0.99));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 24px rgba(200, 107, 255, 0.24),
    0 0 48px rgba(43, 228, 255, 0.12);
}

.global-lightbox__inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.035) 0,
    rgba(255, 255, 255, 0.035) 2px,
    transparent 2px,
    transparent 5px
  );
  opacity: 0.22;
}

.global-lightbox__media {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: calc(92vh - 110px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border: 2px solid rgba(200, 107, 255, 0.9);
  background: #050814;
}

.global-lightbox__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  border: 2px solid #c86bff;
  background: rgba(22, 10, 46, 0.95);
  color: #f5fbff;
  padding: 0.45rem 0.7rem;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(200, 107, 255, 0.2),
    3px 3px 0 rgba(43, 228, 255, 0.14);
}

.global-lightbox__close:hover,
.global-lightbox__close:focus-visible {
  outline: none;
  transform: translate(-1px, -1px);
}

.global-lightbox__hint {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f5fbff;
  text-shadow:
    0 0 8px rgba(200, 107, 255, 0.16),
    0 0 8px rgba(43, 228, 255, 0.1);
}

.theme-level-3 ~ .global-lightbox .global-lightbox__inner,
body[data-lightbox-theme="theme-level-3"] .global-lightbox__inner {
  border-color: #2be4ff;
  background: linear-gradient(180deg, rgba(12, 18, 46, 0.98), rgba(4, 8, 24, 0.99));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 24px rgba(43, 228, 255, 0.24),
    0 0 48px rgba(255, 0, 153, 0.12);
}

body[data-lightbox-theme="theme-level-3"] .global-lightbox__media {
  border-color: rgba(43, 228, 255, 0.85);
}

body[data-lightbox-theme="theme-level-3"] .global-lightbox__close {
  border-color: #2be4ff;
  background: rgba(7, 16, 46, 0.95);
  box-shadow:
    0 0 12px rgba(43, 228, 255, 0.2),
    3px 3px 0 rgba(255, 0, 153, 0.14);
}

body[data-lightbox-theme="theme-level-3"] .global-lightbox__hint {
  text-shadow:
    0 0 8px rgba(43, 228, 255, 0.16),
    0 0 8px rgba(255, 0, 153, 0.1);
}

/* =========================================================
   LEFT SIDEBAR NAV — RETRO RESTYLE
   ========================================================= */

/* --- Shared nav styles (all sizes) --- */
.navbar.fixed-top {
  background: #060c18 !important;
  border: 0 !important;
  font-family: "Courier New", Courier, monospace;
  z-index: 1030;
}

.navbar .navbar-brand {
  color: #f4f8ff !important;
  font-family: "Courier New", Courier, monospace;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.18s ease, text-shadow 0.18s ease;
}

.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus-visible {
  color: #ffffff !important;
  text-shadow: 0 0 10px rgba(95, 132, 184, 0.4);
}

/* --- Top-level nav links --- */
.navbar-nav > .nav-item > .nav-link {
  color: rgba(210, 225, 248, 0.88) !important;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 1rem !important;
  border-radius: 0;
  border-left: 3px solid transparent;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

/* --- Dropdown group headers — dimmer, with expand indicator --- */
.navbar-nav > .nav-item.dropdown > .dropdown-toggle {
  color: rgba(160, 185, 220, 0.7) !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding-top: 0.7rem !important;
  padding-bottom: 0.35rem !important;
  border-left-color: transparent;
  border-top: 1px solid rgba(95, 132, 184, 0.08);
  margin-top: 0.15rem;
  cursor: pointer;
  user-select: none;
}

/* Expanded group header — slightly brighter */
.navbar-nav > .nav-item.dropdown.show > .dropdown-toggle {
  color: rgba(190, 210, 238, 0.88) !important;
}

.navbar-nav > .nav-item.dropdown > .dropdown-toggle::after {
  transition: transform 0.2s ease;
}

.navbar-nav > .nav-item.dropdown.show > .dropdown-toggle::after {
  transform: rotate(180deg);
}

/* --- Group header with active child --- */
.navbar-nav > .nav-item.dropdown > .dropdown-toggle.active {
  color: rgba(200, 216, 240, 0.9) !important;
  border-left-color: rgba(95, 132, 184, 0.35);
  background: transparent !important;
}

/* --- Override Slate theme dark gradient on hover/focus --- */
.navbar .nav-link:hover,
.navbar .nav-link:focus {
  background-image: none !important;
  background-color: transparent !important;
  border-left-color: transparent !important;
  filter: none !important;
  box-shadow: none !important;
}

/* --- Hover / focus on all nav links --- */
.navbar-nav > .nav-item > .nav-link:hover {
  color: #ffffff !important;
  background: rgba(95, 132, 184, 0.08) !important;
  border-left-color: rgba(95, 132, 184, 0.3) !important;
}

.navbar-nav > .nav-item > .nav-link:focus-visible {
  color: #ffffff !important;
  outline: none;
  border-left-color: rgba(95, 132, 184, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(95, 132, 184, 0.2) inset !important;
}

/* --- Active top-level link (direct pages like Home, But Why) --- */
.navbar-nav > .nav-item > .nav-link.active:not(.dropdown-toggle) {
  color: #ffffff !important;
  background: rgba(95, 132, 184, 0.12) !important;
  border-left-color: rgba(95, 132, 184, 0.8);
}

/* --- Dropdown child items --- */
.navbar .dropdown-menu {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 0 0.25rem 0 !important;
  box-shadow: none;
}

.navbar .dropdown-item {
  color: rgba(200, 216, 240, 0.72) !important;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 1rem 0.4rem 1.75rem;
  border-left: 3px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus,
.navbar .dropdown-item:focus-visible {
  color: #ffffff !important;
  background: rgba(95, 132, 184, 0.08) !important;
  border-left-color: rgba(95, 132, 184, 0.25);
}

/* --- Active child page — strongest signal --- */
.navbar .dropdown-item.active {
  color: #ffffff !important;
  background: rgba(95, 132, 184, 0.14) !important;
  border-left-color: rgba(95, 132, 184, 0.9);
  box-shadow: 0 0 6px rgba(95, 132, 184, 0.08) inset;
}

/* --- Utility links (Search / Prev / Next) --- */
.navbar-nav.ms-md-auto .nav-link {
  font-size: 0.68rem;
  opacity: 0.55;
  letter-spacing: 0.08em;
  border-left-width: 0 !important;
  padding-left: 1rem !important;
}

.navbar-nav.ms-md-auto .nav-link:hover,
.navbar-nav.ms-md-auto .nav-link:focus-visible {
  opacity: 1;
}

/* ===========================================
   DESKTOP: LEFT SIDEBAR (≥992px)
   =========================================== */
@media (min-width: 992px) {
  .navbar.fixed-top {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 256px;
    height: 100vh !important;
    border-right: 1px solid rgba(95, 132, 184, 0.2) !important;
    border-bottom: 0 !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
    padding: 0 !important;
    overflow: clip;
    transition:
      transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.25s ease,
      filter 0.3s ease;
  }

  .navbar.fixed-top > .container {
    flex-direction: column !important;
    align-items: stretch !important;
    height: 100%;
    max-width: none;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(95, 132, 184, 0.25) transparent;
    box-sizing: border-box;
  }

  .navbar .navbar-brand {
    display: block;
    padding: 1rem 1rem 0.8rem !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(95, 132, 184, 0.15);
    font-size: 0.82rem;
    white-space: normal;
    line-height: 1.35;
  }

  /* Always show the nav — no collapse on desktop */
  .navbar .navbar-toggler {
    display: none !important;
  }

  .navbar .navbar-collapse {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: visible;
  }

  /* Stack nav links vertically */
  .navbar .navbar-nav {
    flex-direction: column !important;
    width: 100%;
    min-width: 0;
    padding: 0.4rem 0;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.74rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
    min-width: 0;
  }

  /* Dropdowns open inline as a tree, not floating */
  .navbar .nav-item.dropdown {
    position: relative;
  }

  .navbar .dropdown-menu {
    position: static !important;
    display: none;
    float: none !important;
    width: 100%;
    margin: 0 !important;
    transform: none !important;
    transition: height 0.25s ease;
  }

  .navbar .nav-item.dropdown.show > .dropdown-menu,
  .navbar .dropdown-menu.show {
    display: block;
  }

  .navbar .dropdown-item {
    padding: 0.38rem 1rem 0.38rem 1.75rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
  }

  /* Utility links at bottom */
  .navbar-nav.ms-md-auto {
    margin-top: auto !important;
    margin-left: 0 !important;
    border-top: 1px solid rgba(95, 132, 184, 0.15);
    padding: 0.4rem 0;
  }

  /* --- Content offset for sidebar --- */
  body {
    padding-top: 0 !important;
  }

  body > .container {
    margin-left: 256px;
    width: calc(100% - 256px);
    max-width: calc(100% - 256px);
    margin-top: 0 !important;
    padding-top: 0.75rem;
    transition: margin-left 0.3s ease, width 0.3s ease, max-width 0.3s ease;
  }

  /* --- Sidebar hidden state (desktop) — retro CRT power-off --- */
  html.retro-navbar-hidden .navbar.fixed-top {
    transform: translateX(-40px) scaleX(0.92) !important;
    opacity: 0;
    filter: brightness(2) saturate(0);
    pointer-events: none;
  }

  /* --- Sidebar visible state (desktop) — retro power-on --- */
  html:not(.retro-navbar-hidden) .navbar.fixed-top {
    transform: translateX(0) scaleX(1) !important;
    opacity: 1;
    filter: brightness(1) saturate(1);
  }

  @media (prefers-reduced-motion: reduce) {
    .navbar.fixed-top {
      transition: opacity 0.2s ease !important;
    }
    html.retro-navbar-hidden .navbar.fixed-top {
      transform: translateX(0) scaleX(1) !important;
      filter: none;
    }
  }

  html.retro-navbar-hidden body > .container {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }

  html.retro-navbar-hidden body {
    padding-top: 0 !important;
  }
}

/* ===========================================
   MOBILE: TOP BAR (≤991px)
   =========================================== */
@media (max-width: 991.98px) {
  .navbar.fixed-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    height: auto !important;
    border-bottom: 1px solid rgba(95, 132, 184, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    padding: 0.4rem 0.75rem !important;
  }

  .navbar .navbar-toggler {
    border: 1px solid rgba(95, 132, 184, 0.3) !important;
    border-radius: 0;
    padding: 0.3rem 0.5rem;
  }

  .navbar .navbar-toggler:hover,
  .navbar .navbar-toggler:focus-visible {
    border-color: rgba(95, 132, 184, 0.6) !important;
    box-shadow: 0 0 8px rgba(95, 132, 184, 0.15);
    outline: none;
  }

  .navbar .navbar-toggler-icon {
    filter: brightness(0.85);
  }

  .navbar .navbar-collapse {
    background: #060c18;
    border-top: 1px solid rgba(95, 132, 184, 0.15);
    margin-top: 0.4rem;
    padding: 0.4rem 0;
    max-height: 75vh;
    overflow-y: auto;
  }

  .navbar-nav .nav-link {
    padding: 0.6rem 1rem !important;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(95, 132, 184, 0.06);
  }

  .navbar .dropdown-menu {
    padding-left: 1rem !important;
    background: transparent !important;
  }

  .navbar .dropdown-item {
    padding: 0.45rem 1rem;
    font-size: 0.74rem;
    border-bottom: 1px solid rgba(95, 132, 184, 0.04);
  }

  .navbar-nav.ms-md-auto {
    border-top: 1px solid rgba(95, 132, 184, 0.12);
    margin-top: 0.4rem;
    padding-top: 0.4rem;
  }

  /* Mobile: hide/show slides up/down as before */
  html.retro-navbar-hidden .navbar.fixed-top {
    transform: translateY(-100%) !important;
    opacity: 0;
    pointer-events: none;
  }

  html:not(.retro-navbar-hidden) .navbar.fixed-top {
    transform: translateY(0) !important;
    opacity: 1;
  }
}

/* --- Form inputs (search modal, etc.) --- */
.navbar-form .form-control,
.form-control {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f5fbff !important;
  border: 1px solid rgba(95, 132, 184, 0.2) !important;
  border-radius: 0;
  font-family: "Courier New", Courier, monospace;
  box-shadow: none !important;
}

.navbar-form .form-control::placeholder,
.form-control::placeholder {
  color: rgba(200, 216, 240, 0.45) !important;
}


/* =========================================================
   MAINTENANCE PASS 3 FIXES
   ========================================================= */

.retro-section-nav,
.retro-content-footer.retro-section-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  flex-wrap: wrap;
}

.retro-section-nav__link,
.retro-nav-button,
.retro-content-footer .retro-button,
#retro-homepage .retro-button:not(.retro-skip-intro),
.retro-content-page .retro-button {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  min-height: 58px;
  padding: 0.85rem 1rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  box-sizing: border-box;
}

@media (max-width: 560px) {
  .retro-section-nav__link,
  .retro-nav-button,
  .retro-content-footer .retro-button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

.retro-image-panel img,
img[data-lightbox],
img.retro-lightbox-target,
img.global-lightbox-target {
  cursor: zoom-in;
}

.md-header,
.md-tabs {
  background:
    linear-gradient(180deg, rgba(7, 14, 28, 0.98), rgba(2, 7, 18, 0.99)) !important;
  box-shadow:
    0 0 0 1px rgba(43, 228, 255, 0.14) inset,
    0 0 18px rgba(43, 228, 255, 0.08),
    0 0 28px rgba(200, 107, 255, 0.08) !important;
}

.md-header::before,
.md-tabs::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 4px
    ),
    linear-gradient(90deg, rgba(43, 228, 255, 0.12), transparent 20%, transparent 80%, rgba(200, 107, 255, 0.12));
  opacity: 0.75;
}

.md-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(43, 228, 255, 0.18);
}

.md-tabs {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(43, 228, 255, 0.1);
}

.md-header__title,
.md-tabs__link,
.md-header__button,
.md-search__icon,
.md-search__input,
.md-nav__title,
.md-nav__link {
  font-family: "Courier New", Courier, monospace !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.md-tabs__link,
.md-nav__link,
.md-nav__title {
  border: 1px solid rgba(43, 228, 255, 0.12);
  background: rgba(9, 18, 36, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.md-tabs__link {
  margin: 0.25rem 0.18rem;
  padding: 0.72rem 0.9rem;
}

.md-tabs__link:hover,
.md-tabs__link:focus-visible,
.md-nav__link:hover,
.md-nav__title:hover {
  background: rgba(20, 35, 62, 0.82) !important;
  border-color: rgba(43, 228, 255, 0.34) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 12px rgba(43, 228, 255, 0.12);
}

.md-tabs__item--active .md-tabs__link,
.md-nav__item--active > .md-nav__link,
.md-nav__item--active > .md-nav__title {
  background: linear-gradient(180deg, rgba(34, 54, 94, 0.96), rgba(16, 26, 48, 0.96)) !important;
  border-color: rgba(43, 228, 255, 0.42) !important;
  color: #f5fbff !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 14px rgba(43, 228, 255, 0.16),
    3px 3px 0 rgba(200, 107, 255, 0.1);
}

.md-search__form {
  border: 1px solid rgba(43, 228, 255, 0.16);
  background: rgba(8, 15, 28, 0.9) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.md-search__input {
  color: #f5fbff !important;
}


/* =========================================================
   MAINTENANCE PASS 5 FIXES
   ========================================================= */

#retro-homepage .retro-start-panel {
  text-align: center;
}

#retro-homepage .retro-start-panel .retro-nav-button {
  margin-top: 0 !important;
}

#retro-homepage .retro-logo-wrap {
  margin-top: 2.5rem;
}

#retro-homepage .retro-logo-glitch {
  position: relative;
  display: inline-block;
  overflow: visible;
}

#retro-homepage .retro-logo-image {
  position: relative;
  z-index: 2;
}

#retro-homepage .retro-logo-glitch::before,
#retro-homepage .retro-logo-glitch::after {
  z-index: 3;
}

#retro-homepage .retro-logo-glitch:hover::before,
#retro-homepage .retro-logo-glitch:hover::after,
#retro-homepage .retro-logo-glitch.is-glitching::before,
#retro-homepage .retro-logo-glitch.is-glitching::after {
  opacity: 1;
}

.retro-content-page.theme-level-2::after {
  background-image:
    radial-gradient(circle, rgba(255, 95, 162, 0.18) 0%, rgba(255, 95, 162, 0.12) 26%, transparent 64%),
    radial-gradient(circle, rgba(255, 215, 232, 0.12) 0%, rgba(255, 215, 232, 0.06) 22%, transparent 62%),
    radial-gradient(circle, rgba(255, 95, 162, 0.1) 0%, transparent 58%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 28%, transparent 44%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 58%, transparent 72%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 28%, transparent 44%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 58%, transparent 72%);
  background-repeat: no-repeat;
  background-size:
    112px 112px,
    88px 88px,
    72px 72px,
    190% 2px,
    190% 1px,
    2px 190%,
    1px 190%;
  background-position:
    34px 46px,
    calc(100% - 56px) calc(100% - 62px),
    calc(100% - 140px) 72px,
    -108% 0,
    108% 100%,
    0 -108%,
    100% 108%;
  animation: retroFramePinkArcadePulse 18s ease-in-out infinite;
}

.retro-content-page.theme-level-4::after {
  background-image:
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 20%, transparent 34%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 20%, transparent 34%),
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(159, 124, 255, 0.05) 22px 23px, transparent 23px 44px),
    repeating-linear-gradient(45deg, transparent 0 36px, rgba(232, 220, 255, 0.04) 36px 37px, transparent 37px 74px),
    radial-gradient(circle at 72px calc(100% - 72px), rgba(159, 124, 255, 0.12) 0%, transparent 42%),
    radial-gradient(circle at calc(100% - 84px) 84px, rgba(232, 220, 255, 0.09) 0%, transparent 40%);
  background-repeat: no-repeat;
  background-size:
    240% 2px,
    2px 240%,
    100% 100%,
    100% 100%,
    140px 140px,
    120px 120px;
  background-position:
    -140% 100%,
    100% 140%,
    0 0,
    0 0,
    0 0,
    0 0;
  animation: retroFramePurpleVectorSweep 24s ease-in-out infinite;
}

@keyframes retroFramePinkArcadePulse {
  0%, 100% {
    background-position:
      34px 46px,
      calc(100% - 56px) calc(100% - 62px),
      calc(100% - 140px) 72px,
      -108% 0,
      108% 100%,
      0 -108%,
      100% 108%;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      52px 58px,
      calc(100% - 74px) calc(100% - 78px),
      calc(100% - 122px) 98px,
      96% 0,
      -96% 100%,
      0 96%,
      100% -96%;
    opacity: 0.9;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 16px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFramePurpleVectorSweep {
  0%, 100% {
    background-position:
      -140% 100%,
      100% 140%,
      0 0,
      0 0,
      0 0,
      0 0;
    opacity: 0.76;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      96% 100%,
      100% -96%,
      9px 0,
      -7px 0,
      0 0,
      0 0;
    opacity: 0.88;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 15px var(--retro-accent-glow-soft);
  }
}

.retro-section-nav__link,
.retro-nav-button,
.retro-content-footer .retro-button,
#retro-homepage .retro-button:not(.retro-skip-intro),
.retro-content-page .retro-button {
  flex: 0 0 220px !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  min-height: 64px !important;
  height: auto !important;
  max-height: none !important;
  padding: 0.85rem 1rem !important;
  line-height: 1.2 !important;
  white-space: normal;
}

@media (max-width: 560px) {
  .retro-section-nav__link,
  .retro-nav-button,
  .retro-content-footer .retro-button {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 64px !important;
    max-height: none !important;
  }
}


/* =========================================================
   MAINTENANCE PASS 6 FIXES
   ========================================================= */

/* Home start button should always use the shared transition */
#retro-homepage .retro-start-panel .retro-nav-button,
#retro-homepage .retro-start-panel a[href],
#retro-homepage .retro-start-panel a[data-target] {
  cursor: pointer;
}

/* Consistent button sizing across all footer/home navigation buttons */
.retro-section-nav > a,
.retro-section-nav > .retro-button,
.retro-content-footer .retro-button,
a.retro-nav-button,
a.retro-section-nav__link,
#retro-homepage .retro-button:not(.retro-skip-intro),
.retro-content-page .retro-button {
  flex: 0 0 220px !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
  min-height: 64px !important;
  height: auto !important;
  max-height: none !important;
  padding: 0.85rem 1rem !important;
  line-height: 1.2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

@media (max-width: 560px) {
  .retro-section-nav > a,
  .retro-section-nav > .retro-button,
  .retro-content-footer .retro-button,
  a.retro-nav-button,
  a.retro-section-nav__link {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 64px !important;
    max-height: none !important;
  }
}

/* =========================================================
   MAINTENANCE PASS 10 FIXES
   ========================================================= */

.retro-step-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  flex-wrap: wrap;
}

.retro-step-nav .retro-step-button,
.retro-step-nav .retro-button-pulse.retro-step-button {
  flex: 0 0 220px;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  min-height: 64px;
  height: auto;
  max-height: none;
  margin-top: 0 !important;
  padding: 0.85rem 1rem !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2 !important;
  box-sizing: border-box;
}

.retro-step-nav .retro-button-pulse.retro-step-button {
  font-size: 1rem !important;
}

@media (max-width: 560px) {
  .retro-step-nav .retro-step-button,
  .retro-step-nav .retro-button-pulse.retro-step-button {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 64px;
    max-height: none;
  }
}

/* Purple theme: same monitor scan movement as blue, using purple tones. */
.retro-content-page.theme-level-1::after,
.retro-content-page.theme-level-4::after {
  background-image:
    linear-gradient(
      180deg,
      transparent 0%,
      rgba(159, 124, 255, 0.16) 34%,
      rgba(232, 220, 255, 0.42) 50%,
      rgba(159, 124, 255, 0.16) 66%,
      transparent 100%
    ),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    repeating-linear-gradient(
      90deg,
      rgba(159, 124, 255, 0.075) 0 1px,
      transparent 1px 18px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(159, 124, 255, 0.075) 0 1px,
      transparent 1px 18px
    );
  background-repeat: no-repeat;
  background-size:
    100% 140px,
    240% 2px,
    240% 1px,
    2px 240%,
    1px 240%,
    100% 100%,
    100% 100%;
  background-position:
    0 -140px,
    -140% 0,
    140% 100%,
    0 -140%,
    100% 140%,
    0 0,
    0 0;
  animation: retroFrameBlueMonitorScan 24s linear infinite;
}

/* Pink theme: same monitor scan movement as blue, using pink tones. */
.retro-content-page.theme-level-2::after {
  background-image:
    linear-gradient(
      180deg,
      transparent 0%,
      rgba(255, 95, 162, 0.16) 34%,
      rgba(255, 215, 232, 0.42) 50%,
      rgba(255, 95, 162, 0.16) 66%,
      transparent 100%
    ),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 95, 162, 0.075) 0 1px,
      transparent 1px 18px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(255, 95, 162, 0.075) 0 1px,
      transparent 1px 18px
    );
  background-repeat: no-repeat;
  background-size:
    100% 140px,
    240% 2px,
    240% 1px,
    2px 240%,
    1px 240%,
    100% 100%,
    100% 100%;
  background-position:
    0 -140px,
    -140% 0,
    140% 100%,
    0 -140%,
    100% 140%,
    0 0,
    0 0;
  animation: retroFrameBlueMonitorScan 24s linear infinite;
}

/* Blue theme: single downward CRT scan, fixed-size so speed stays consistent. */
.retro-content-page.theme-level-3::after {
  background-image:
    linear-gradient(
      180deg,
      transparent 0%,
      rgba(67, 224, 255, 0.16) 34%,
      rgba(216, 248, 255, 0.42) 50%,
      rgba(67, 224, 255, 0.16) 66%,
      transparent 100%
    ),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(90deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-1) 18%, transparent 32%),
    linear-gradient(180deg, transparent 0%, var(--retro-frame-line-2) 68%, transparent 82%),
    repeating-linear-gradient(
      90deg,
      rgba(67, 224, 255, 0.075) 0 1px,
      transparent 1px 18px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(67, 224, 255, 0.075) 0 1px,
      transparent 1px 18px
    );
  background-repeat: no-repeat;
  background-size:
    100% 140px,
    240% 2px,
    240% 1px,
    2px 240%,
    1px 240%,
    100% 100%,
    100% 100%;
  background-position:
    0 -140px,
    -140% 0,
    140% 100%,
    0 -140%,
    100% 140%,
    0 0,
    0 0;
  animation: retroFrameBlueMonitorScan 24s linear infinite;
}

@keyframes retroFramePurpleHudSweep {
  0% {
    background-position:
      -112% 0,
      112% 100%,
      0 -112%,
      100% 112%,
      0 0,
      0 0,
      0 0;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      92% 0,
      -92% 100%,
      0 92%,
      100% -92%,
      6px 0,
      0 6px,
      0 0;
    opacity: 0.9;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 15px var(--retro-accent-glow-soft);
  }

  100% {
    background-position:
      -112% 0,
      112% 100%,
      0 -112%,
      100% 112%,
      12px 0,
      0 12px,
      0 0;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFramePinkArcadeGrid {
  0% {
    background-position:
      -104% 0,
      104% 100%,
      0 -104%,
      100% 104%,
      0 0,
      0 0,
      34px calc(100% - 106px),
      calc(100% - 94px) 34px;
    opacity: 0.8;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  50% {
    background-position:
      92% 0,
      -92% 100%,
      0 92%,
      100% -92%,
      8px 0,
      0 8px,
      38px calc(100% - 110px),
      calc(100% - 98px) 38px;
    opacity: 0.9;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 16px var(--retro-accent-glow-soft);
  }

  100% {
    background-position:
      -104% 0,
      104% 100%,
      0 -104%,
      100% 104%,
      16px 0,
      0 16px,
      34px calc(100% - 106px),
      calc(100% - 94px) 34px;
    opacity: 0.8;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }
}

@keyframes retroFrameBlueMonitorScan {
  0% {
    background-position:
      0 -140px,
      -140% 0,
      140% 100%,
      0 -140%,
      100% 140%,
      0 0,
      0 0;
    opacity: 0.78;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 10px var(--retro-accent-glow-soft);
  }

  70% {
    opacity: 0.9;
  }

  100% {
    background-position:
      0 calc(100% + 140px),
      -40% 0,
      40% 100%,
      0 -40%,
      100% 40%,
      10px 0,
      0 10px;
    opacity: 0.82;
    box-shadow:
      inset 0 0 0 1px var(--retro-frame-shadow),
      0 0 15px var(--retro-accent-glow-soft);
  }
}


/* =========================================================
   MAINTENANCE PASS 7 ENHANCEMENTS
   ========================================================= */

.retro-auto-strong {
  color: var(--retro-heading);
  font-weight: 700;
}

.retro-copy-button {
  position: relative;
  overflow: visible;
}

.retro-copy-sparkle-burst {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.retro-copy-sparkle {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  border: 1px solid var(--retro-accent-soft);
  background: var(--retro-accent);
  box-shadow:
    0 0 8px var(--retro-accent-glow),
    0 0 14px var(--retro-accent-glow-soft);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: retroCopySparkle 0.72s ease-out forwards;
  animation-delay: var(--sparkle-delay, 0ms);
}

#retro-homepage .retro-logo-glitch {
  cursor: pointer;
}

#retro-homepage .retro-logo-glitch:hover::before,
#retro-homepage .retro-logo-glitch:hover::after,
#retro-homepage .retro-logo-glitch:focus-within::before,
#retro-homepage .retro-logo-glitch:focus-within::after {
  opacity: 0.82;
}

#retro-homepage .retro-logo-glitch:hover::before,
#retro-homepage .retro-logo-glitch.is-glitching::before {
  animation: retroLogoGlitchBefore 1.2s steps(6, end) infinite;
}

#retro-homepage .retro-logo-glitch:hover::after,
#retro-homepage .retro-logo-glitch.is-glitching::after {
  animation: retroLogoGlitchAfter 1.2s steps(6, end) infinite;
}

@keyframes retroCopySparkle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.25);
  }
  18% {
    opacity: 1;
    transform: translate(calc(-50% + (var(--sparkle-x) * 0.2)), calc(-50% + (var(--sparkle-y) * 0.2))) rotate(45deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sparkle-x)), calc(-50% + var(--sparkle-y))) rotate(45deg) scale(0.35);
  }
}


/* =========================================================
   MAINTENANCE PASS 13 FIXES
   Desktop side navigation rail with active page indicator
   ========================================================= */

:root {
  --retro-side-rail-width: 272px;
  --retro-header-offset: 88px;
}

.retro-current-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 0.9rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(43, 228, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 17, 31, 0.72);
  color: #dff7ff;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 12px rgba(43, 228, 255, 0.08);
}

.retro-side-rail {
  display: none;
}

@media (min-width: 1180px) {
  .retro-side-rail-enabled .retro-primary-nav {
    display: none !important;
  }

  .retro-side-rail-enabled .retro-side-rail {
    position: fixed;
    top: var(--retro-header-offset);
    left: 20px;
    bottom: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    width: var(--retro-side-rail-width);
    padding: 1rem;
    border: 1px solid rgba(95, 132, 184, 0.55);
    background:
      linear-gradient(180deg, rgba(8, 17, 31, 0.94), rgba(9, 21, 37, 0.98));
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.03),
      0 0 18px rgba(43, 228, 255, 0.08),
      0 0 28px rgba(200, 107, 255, 0.08);
    overflow: hidden;
  }

  .retro-side-rail::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 4px
    );
    opacity: 0.32;
  }

  .retro-side-rail > * {
    position: relative;
    z-index: 1;
  }

  .retro-side-rail__header {
    margin-bottom: 0.9rem;
    padding: 0.9rem 0.95rem;
    border: 1px solid rgba(43, 228, 255, 0.2);
    background: rgba(11, 21, 39, 0.82);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  }

  .retro-side-rail__eyebrow {
    margin-bottom: 0.35rem;
    color: rgba(201, 226, 255, 0.74);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.73rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  .retro-side-rail__current {
    color: #ffffff;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .retro-side-rail__nav {
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
    min-height: 0;
    padding-right: 0.2rem;
    overflow-y: auto;
  }

  .retro-side-rail__link {
    position: relative;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
    padding: 0.82rem 0.85rem;
    border: 1px solid rgba(95, 132, 184, 0.22);
    background: rgba(9, 18, 36, 0.6);
    color: rgba(230, 238, 250, 0.9) !important;
    font-family: "Courier New", Courier, monospace;
    text-decoration: none !important;
    transition:
      transform 0.18s ease,
      border-color 0.18s ease,
      background 0.18s ease,
      box-shadow 0.18s ease,
      color 0.18s ease;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  }

  .retro-side-rail__link:hover,
  .retro-side-rail__link:focus-visible {
    color: #ffffff !important;
    background: rgba(20, 35, 62, 0.88);
    border-color: rgba(43, 228, 255, 0.34);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 12px rgba(43, 228, 255, 0.1);
    transform: translateX(2px);
  }

  .retro-side-rail__link.is-active {
    background: linear-gradient(180deg, rgba(34, 54, 94, 0.96), rgba(16, 26, 48, 0.96));
    border-color: rgba(43, 228, 255, 0.44);
    color: #ffffff !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.05),
      0 0 14px rgba(43, 228, 255, 0.16),
      3px 3px 0 rgba(200, 107, 255, 0.1);
  }

  .retro-side-rail__link.is-active::after {
    content: "YOU ARE HERE";
    position: absolute;
    top: -0.58rem;
    right: 0.7rem;
    padding: 0.15rem 0.42rem;
    border: 1px solid rgba(43, 228, 255, 0.28);
    background: rgba(6, 13, 26, 0.96);
    color: #dff7ff;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .retro-side-rail__index {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 1.75rem;
    border: 1px solid rgba(43, 228, 255, 0.16);
    background: rgba(8, 15, 28, 0.78);
    color: rgba(201, 226, 255, 0.82);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  .retro-side-rail__label {
    display: block;
    font-size: 0.8rem;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .retro-side-rail-enabled .retro-main-container {
    box-sizing: border-box;
    padding-left: calc(var(--retro-side-rail-width) + 28px) !important;
  }

  .retro-side-rail-enabled .retro-main-content {
    max-width: 1080px;
  }
}

@media (max-width: 1179px) {
  .retro-current-chip {
    display: none;
  }
}


/* =========================================================
   MAINTENANCE PASS 13 FIXES
   DESKTOP TRAINING MAP SIDEBAR
   ========================================================= */

.retro-training-sidebar {
  display: none;
}

.retro-current-chip {
  display: none;
}

@media (min-width: 1200px) {
  body.retro-has-training-sidebar .navbar.fixed-top {
    display: none !important;
  }

  body.retro-has-training-sidebar .retro-training-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: fixed;
    top: 5rem;
    left: 1rem;
    bottom: 1rem;
    width: 310px;
    padding: 1rem;
    z-index: 95;
    border: 1px solid rgba(43, 228, 255, 0.18);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(6, 14, 30, 0.96), rgba(3, 8, 18, 0.98));
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.03) inset,
      0 0 18px rgba(43, 228, 255, 0.08),
      0 0 28px rgba(200, 107, 255, 0.08);
    overflow: hidden;
  }

  body.retro-has-training-sidebar .retro-training-sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.03) 0,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 4px
      ),
      linear-gradient(90deg, rgba(43, 228, 255, 0.1), transparent 18%, transparent 82%, rgba(200, 107, 255, 0.12));
    opacity: 0.8;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__heading,
  body.retro-has-training-sidebar .retro-training-sidebar__current-label {
    position: relative;
    z-index: 1;
    font-family: "Courier New", Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__heading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(43, 228, 255, 0.22);
    border-radius: 999px;
    background: rgba(10, 22, 42, 0.86);
    color: #dff7ff;
    font-size: 0.72rem;
    box-shadow: 0 0 14px rgba(43, 228, 255, 0.08);
  }

  body.retro-has-training-sidebar .retro-training-sidebar__current-label {
    color: rgba(223, 247, 255, 0.82);
    font-size: 0.78rem;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__current-page {
    display: block;
    margin-top: 0.25rem;
    color: #ffffff;
    font-size: 0.98rem;
    line-height: 1.35;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__list {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-right: 0.2rem;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__list::-webkit-scrollbar {
    width: 10px;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__list::-webkit-scrollbar-thumb {
    background: rgba(43, 228, 255, 0.22);
    border-radius: 999px;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__link {
    position: relative;
    display: block;
    padding: 0.82rem 0.95rem;
    border: 1px solid rgba(43, 228, 255, 0.14);
    border-radius: 14px;
    background: rgba(8, 18, 36, 0.74);
    color: rgba(235, 244, 255, 0.84);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.88rem;
    line-height: 1.35;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    transition:
      transform 0.18s ease,
      background 0.18s ease,
      border-color 0.18s ease,
      box-shadow 0.18s ease,
      color 0.18s ease;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__link:hover,
  body.retro-has-training-sidebar .retro-training-sidebar__link:focus-visible {
    color: #ffffff;
    background: rgba(18, 34, 62, 0.92);
    border-color: rgba(43, 228, 255, 0.34);
    transform: translateX(3px);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 12px rgba(43, 228, 255, 0.12);
  }

  body.retro-has-training-sidebar .retro-training-sidebar__link.is-active {
    color: #ffffff;
    background: linear-gradient(180deg, rgba(32, 52, 92, 0.98), rgba(16, 27, 48, 0.98));
    border-color: rgba(43, 228, 255, 0.44);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.05),
      0 0 14px rgba(43, 228, 255, 0.16),
      3px 3px 0 rgba(200, 107, 255, 0.12);
  }

  body.retro-has-training-sidebar .retro-training-sidebar__link.is-active::before {
    content: "YOU ARE HERE";
    display: block;
    margin-bottom: 0.35rem;
    color: #7cf7ff;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
  }

  body.retro-has-training-sidebar .retro-training-sidebar__link.is-active::after {
    content: "";
    position: absolute;
    top: 0.75rem;
    bottom: 0.75rem;
    left: -1px;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, #2be4ff, #c86bff);
    box-shadow: 0 0 12px rgba(43, 228, 255, 0.22);
  }

  body.retro-has-training-sidebar .retro-current-chip {
    display: inline-flex;
    align-items: center;
    margin-left: 0.8rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(43, 228, 255, 0.22);
    border-radius: 999px;
    background: rgba(8, 18, 36, 0.82);
    color: rgba(223, 247, 255, 0.92);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
  }

  body.retro-has-training-sidebar .md-main__inner,
  body.retro-has-training-sidebar .md-footer__inner,
  body.retro-has-training-sidebar .md-content,
  body.retro-has-training-sidebar .md-content__inner,
  body.retro-has-training-sidebar .md-main .md-grid {
    max-width: none !important;
  }

  body.retro-has-training-sidebar .md-main__inner,
  body.retro-has-training-sidebar .md-footer__inner,
  body.retro-has-training-sidebar .md-main .md-grid {
    margin-left: 340px !important;
    margin-right: 1.25rem !important;
  }
}


.retro-step-button.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.retro-step-button.is-disabled {
  opacity: 0.28;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* =========================================================
   PAGE CENTERING (Slate / Bootstrap overrides)
   ========================================================= */

/* Hide the empty Slate TOC sidebar so content can centre */
body > .container > .row > .col-md-3 {
  display: none !important;
}

/* Make the main content column full-width and centred */
body > .container > .row > .col-md-9 {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  margin-left: auto;
  margin-right: auto;
}

/* Give the outer container breathing room */
body > .container {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  box-sizing: border-box;
}

/* =========================================================
   INLINE CONTENT LINKS — BOLD
   ========================================================= */

.retro-content-page p a,
.retro-content-page li a,
.retro-content-page td a {
  font-weight: 700;
}

/* =========================================================
   RESPONSIVENESS — GLOBAL FIXES
   ========================================================= */

/* Prevent horizontal overflow on mobile only */
@media (max-width: 991px) {
  html, body {
    overflow-x: hidden;
  }
}

/* Responsive images and iframes everywhere */
.retro-content-page img,
.retro-content-page video {
  max-width: 100%;
  height: auto;
}

.retro-content-page iframe {
  max-width: 100%;
}

/* Tablet breakpoint */
@media (max-width: 991px) {
  body > .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #retro-homepage,
  .retro-content-page {
    padding: 22px;
    max-width: 100%;
    margin-left: 8px;
    margin-right: 8px;
  }

  .retro-content-page h1 {
    font-size: 2.6rem;
  }

  .retro-content-page h2 {
    font-size: 1.6rem;
  }

  .retro-video-embed {
    max-width: 100%;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  #retro-homepage,
  .retro-content-page {
    padding: 14px;
    margin-left: 4px;
    margin-right: 4px;
    border-width: 1px;
  }

  .retro-content-page h1 {
    font-size: 1.8rem;
  }

  .retro-content-page p,
  .retro-content-page li {
    font-size: 1.02rem;
    line-height: 1.65;
  }

  .retro-step-indicator {
    font-size: 0.85rem;
  }

  .retro-content-kicker {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }
}

/* =========================================================
   SEARCH HINTS (homepage)
   ========================================================= */

.retro-search-hints {
  text-align: center;
}

.retro-search-hints h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.retro-search-hints p {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.retro-search-hints kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--retro-border-soft);
  background: rgba(255, 255, 255, 0.06);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
  line-height: 1;
}

.retro-search-hints__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.retro-search-hints__list li {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--retro-border-soft);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
  color: var(--retro-text);
  letter-spacing: 0.03em;
}

/* =========================================================
   SLATE SEARCH MODAL — RETRO THEME
   ========================================================= */

#mkdocs_search_modal .modal-content {
  background: var(--retro-bg, #08111f);
  border: 1px solid var(--retro-border-soft, #46658f);
  color: var(--retro-text, #a9d0ff);
  font-family: "Courier New", Courier, monospace;
}

#mkdocs_search_modal .modal-header {
  border-bottom-color: var(--retro-border-soft, #46658f);
}

#mkdocs_search_modal .modal-footer {
  border-top-color: var(--retro-border-soft, #46658f);
}

#mkdocs_search_modal .modal-title {
  color: var(--retro-heading, #d7e9ff);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1rem;
}

#mkdocs_search_modal .form-control {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--retro-border-soft, #46658f) !important;
  color: #f5fbff !important;
  font-family: "Courier New", Courier, monospace;
}

#mkdocs_search_modal .form-control::placeholder {
  color: rgba(169, 208, 255, 0.5) !important;
}

#mkdocs-search-results {
  font-family: "Courier New", Courier, monospace;
}

#mkdocs-search-results a {
  color: var(--retro-link, #c9e2ff) !important;
  text-decoration: none;
  display: block;
  padding: 0.6rem 0.75rem;
  margin: 0.25rem 0;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#mkdocs-search-results a:hover {
  color: #ffffff !important;
  background: rgba(95, 132, 184, 0.1);
  border-left-color: rgba(95, 132, 184, 0.6);
}

#mkdocs-search-results p {
  color: rgba(169, 208, 255, 0.65);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0.2rem 0 0;
}

/* =========================================================
   FIX: Home page Start Here button height
   The column-direction .retro-start-panel causes the shared
   flex: 0 0 220px rule to set the button HEIGHT to 220px.
   Override to auto so the button sizes normally.
   ========================================================= */
#retro-homepage .retro-start-panel .retro-button {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 64px !important;
}

/* =========================================================
   HOMEPAGE RESPONSIVE
   ========================================================= */

@media (max-width: 560px) {
  #retro-homepage .retro-boot-screen {
    min-height: 280px;
    padding: 2rem 1rem 1.25rem;
  }

  #retro-homepage .retro-hero {
    padding: 1.5rem 0 0.5rem;
  }

  #retro-homepage .retro-hero h1 {
    font-size: 2rem;
  }

  #retro-homepage .retro-hero .retro-start-panel {
    margin-top: 1.5rem;
    padding: 1.5rem 1rem;
  }

  #retro-homepage .retro-logo-wrap {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }
}
