.site-nav {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  min-height: 40px;
}

.site-nav > a,
.nav-all-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 36px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #6d28d9;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.site-nav > a:hover,
.nav-all-toggle:hover { background: #faf5ff; }

.site-nav > a[aria-current="page"] {
  background: #f3e8ff;
  border-color: #e9d8fd;
  color: #3b1d6e;
}

.nav-caret {
  display: inline-block;
  width: 0.8em;
  margin-left: 0.35em;
  text-align: center;
}

.nav-all-toggle[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

.site-nav > a:focus-visible,
.nav-all-toggle:focus-visible,
.nav-all-menu a:focus-visible,
.workflow a:focus-visible,
.footer-silos a:focus-visible,
.indent-control select:focus-visible {
  outline: 3px solid #d8b4fe;
  outline-offset: 3px;
}

.nav-all { display: inline-flex; align-items: center; }

.nav-all-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #e9d8fd;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(109, 40, 217, 0.12);
}

.nav-all-menu[hidden] { display: none !important; }

.nav-all-heading {
  margin: 0 0 6px;
  color: #3b1d6e;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-all-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-all-menu a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  color: #6d28d9;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
}

.nav-all-menu a:hover { background: #faf5ff; }

.nav-all-menu a[aria-current="page"] {
  background: #f3e8ff;
  color: #3b1d6e;
}

.footer-note { margin: 0; }

.footer-silos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 24px;
  margin-top: 18px;
}

.footer-heading {
  margin: 0 0 8px;
  color: #3b1d6e;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-silos a {
  display: block;
  margin: 5px 0;
  color: #6d28d9;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.footer-silos a:hover { text-decoration: underline; }

.workflow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
}

.workflow-label {
  color: #6b5b80;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workflow a {
  color: #6d28d9;
  font-weight: 700;
  text-decoration: none;
}

.workflow a:hover { text-decoration: underline; }

.stats-caption {
  margin: 14px 0 0;
  color: #6b5b80;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.stats div {
  background: #faf5ff;
  border-radius: 12px;
  padding: 8px 10px;
}

.stats dt {
  color: #6b5b80;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats dd {
  margin: 2px 0 0;
  color: #3b1d6e;
  font-weight: 700;
}

.indent-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3b1d6e;
  font-weight: 700;
}

.indent-control select,
.field-input {
  font: inherit;
  font-weight: 700;
  color: #3b1d6e;
  background: #ffffff;
  border: 1px solid #e4d4f5;
  border-radius: 999px;
  padding: 10px 14px;
}

.file-btn { position: relative; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editor.dragover {
  outline: 3px dashed #7c3aed;
  outline-offset: 2px;
}

.editor.editor-error {
  border-color: #b42318;
  box-shadow: 0 0 0 3px #ffd6d2;
}

.toast {
  position: fixed;
  z-index: 30;
  top: 16px;
  left: 16px;
  right: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid #abefc6;
  border-radius: 14px;
  background: #ecfdf3;
  color: #067647;
  font-weight: 700;
  box-shadow: 0 16px 40px rgba(109, 40, 217, 0.12);
}

.toast[hidden] { display: none; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3b1d6e;
  font-weight: 700;
}

.diff-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.diff-list li {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-added { background: #ecfdf3; color: #067647; }
.diff-removed { background: #fff1f0; color: #b42318; }
.diff-modified { background: #fffaeb; color: #b54708; }

.stack { display: grid; gap: 16px; }

.tool-note {
  margin: 8px 0 0;
  color: #6b5b80;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .footer-silos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-all-menu {
    grid-template-columns: 1fr;
    max-height: 70vh;
    overflow: auto;
  }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indent-control { width: 100%; }
  .indent-control select { flex: 1; }
}

@media (max-width: 520px) {
  .footer-silos { grid-template-columns: 1fr; }
}

/* AdSense slots stay out of the layout until AdSense is activated.
   display:none keeps them from affecting CLS. min-height applies only
   after that display rule is changed to block. These boxes load no script. */
.ad-slot {
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

.ad-slot-leaderboard { min-height: 90px; }
.ad-slot-rectangle { min-height: 250px; }
