/* Shared navigation, including explicit and system dark themes. */
@scope (html[data-page]) {
  /* Shared fonts, palette, and root behavior. */

  :scope {
    --font-display: 'Avenir Next Condensed', 'Arial Narrow', 'Trebuchet MS', sans-serif;
    --font-body: 'Charter', 'Georgia', 'Times New Roman', serif;
    --font-mono: 'SF Mono', 'Menlo', 'Consolas', 'Liberation Mono', monospace;
    --ground: #FAFBFF;
    --surface: #F0E6FF;
    --text-primary: #1B0A2E;
    --text-secondary: #4A3A5C;
    --text-muted: #7A6B8A;
    --accent: #7B2FBE;
    --accent-text: #7B2FBE;
    --accent-fill: #7B2FBE;
    --accent-fill-border: #7B2FBE;
    --accent-bright: #E040A0;
    --accent-glow: rgba(123, 47, 190, 0.12);
    --border: #D8C8EE;
    --border-light: #EDE4F7;
    --card-bg: #FFFFFF;
    --card-shadow: rgba(27, 10, 46, 0.08);
    --code-bg: #F5F0FA;
    --code-accent: #6B21A8;
    scroll-behavior: smooth;
  }

  @media (prefers-color-scheme: dark) {
  :scope:not([data-theme="light"]) {
    --ground: #111014;
    --surface: #19171E;
    --text-primary: #F0E6FF;
    --accent: #D1A4FF;
    --accent-text: #D1A4FF;
    --code-accent: var(--accent-text);
    --accent-fill: #65438A;
    --accent-fill-border: #8963B3;
    --accent-bright: #D99BBD;
    --accent-glow: rgba(168, 85, 247, 0.15);
    --border: #38323F;
    --border-light: #38323F;
    --card-bg: #19171E;
    --card-shadow: rgba(0, 0, 0, 0.3);
  }
}

  :scope[data-theme="dark"] {
    --ground: #111014;
    --surface: #19171E;
    --text-primary: #F0E6FF;
    --accent: #D1A4FF;
    --accent-text: #D1A4FF;
    --code-accent: var(--accent-text);
    --accent-fill: #65438A;
    --accent-fill-border: #8963B3;
    --accent-bright: #D99BBD;
    --accent-glow: rgba(168, 85, 247, 0.15);
    --border: #38323F;
    --border-light: #38323F;
    --card-bg: #19171E;
    --card-shadow: rgba(0, 0, 0, 0.3);
  }

  /* Navigation between guides */
  .guide-nav {
    --guide-hover-bg: rgba(255, 255, 255, 0.6);
    --guide-active-bg: var(--card-bg);
    --guide-active-text: var(--accent);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
    gap: 0.25rem;
    margin: 1.5rem auto -0.5rem;
    padding: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  }

  .guide-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .guide-nav a:hover {
    color: var(--text-primary);
    background: var(--guide-hover-bg);
  }

  .guide-nav a[aria-current="page"] {
    background: var(--guide-active-bg);
    color: var(--guide-active-text);
    box-shadow: 0 1px 3px var(--card-shadow), 0 1px 2px rgba(0, 0, 0, 0.08);
  }

  .guide-nav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  :scope[data-theme="dark"] .guide-nav {
    --guide-hover-bg: rgba(255, 255, 255, 0.08);
    --guide-active-bg: #6b21a8;
    --guide-active-text: #ffffff;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .guide-nav {
      --guide-hover-bg: rgba(255, 255, 255, 0.08);
      --guide-active-bg: #6b21a8;
      --guide-active-text: #ffffff;
    }
}
}

/* Shared workshop/report tokens; page-specific differences remain below. */
@scope (html:is([data-page="bugs"], [data-page="index"], [data-page="recap"])) {
  :scope {
    --surface-alt: #E8DCF5;
    --nav-bg: rgba(250, 251, 255, 0.92);
    --severity-critical: #DC3545;
    --severity-major: #E8960C;
    --severity-minor: #0EA5A0;
    --severity-critical-bg: #FFF0F1;
    --severity-major-bg: #FFF8E6;
    --severity-minor-bg: #E6FAF9;
    --role-dev: #7B2FBE;
    --role-pm: #E040A0;
    --role-lead: #2563EB;
    --role-qa: #0EA5A0;
    --role-director: #9333EA;
    --role-support: #D97706;
    --role-design: #9D3774;
  }

  @media (prefers-color-scheme: dark) {
  :scope:not([data-theme="light"]) {
    --nav-bg: rgba(13, 8, 21, 0.92);
    --severity-critical-bg: #2A0A10;
    --severity-major-bg: #2A1E05;
    --severity-minor-bg: #0A2220;
  }
}

  :scope[data-theme="dark"] {
    --nav-bg: rgba(13, 8, 21, 0.92);
    --severity-critical-bg: #2A0A10;
    --severity-major-bg: #2A1E05;
    --severity-minor-bg: #0A2220;
  }
}

.severity-badge {
  flex-shrink: 0;
  width: 5.5rem;
  padding: 0.3rem 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 4px;
}

.severity-badge.critical {
  background: var(--severity-critical-bg);
  color: var(--severity-critical);
}

.severity-badge.major {
  background: var(--severity-major-bg);
  color: var(--severity-major);
}

.severity-badge.minor {
  background: var(--severity-minor-bg);
  color: var(--severity-minor);
}

.effort-matrix {
  margin-top: 1.25rem;
  border-collapse: separate;
  border-spacing: 0.35rem;
  width: 100%;
  max-width: 40rem;
}

.effort-matrix th,
.effort-matrix td {
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-size: 0.88rem;
  border-radius: 6px;
}

.effort-matrix th {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  font-weight: 600;
}

.effort-matrix td {
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.35;
}

.effort-matrix td.quick-win {
  background: #8540B5;
  color: #ffffff;
  font-weight: 600;
}

.effort-matrix td.quick-win > .board-guidance {
  color: #ffffff;
  font-weight: 700;
}

.effort-matrix .row-label {
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
  padding-right: 0.9rem;
}

@scope (html[data-page="bugs"]) {
:scope {
    --cat-css: #7B2FBE;
    --cat-css-bg: #F0E6FF;
    --cat-device: #02a0c7;
    --cat-device-bg: #e9fafa;
    --cat-interaction: #E8960C;
    --cat-interaction-bg: #FFF8E6;
    --cat-form: #DC3545;
    --cat-form-bg: #FFF0F1;
    --cat-search: #253EEB;
    --cat-search-bg: #EFF6FF;
    --cat-data: #059669;
    --cat-data-bg: #ECFDF5;
    --cat-tag-border: rgba(255, 255, 255, 0.12);
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) {
    --text-secondary: #ebe3f6;
    --text-muted: #8A7A9E;
    --code-bg: #1A1230;
    --cat-css: #E9D5FF;
    --cat-css-bg: rgba(216, 180, 254, 0.12);
    --cat-device: #BAE6FD;
    --cat-device-bg: rgba(125, 211, 252, 0.12);
    --cat-interaction: #ffefb0;
    --cat-interaction-bg: rgba(252, 211, 77, 0.12);
    --cat-form: #FECACA;
    --cat-form-bg: rgba(252, 165, 165, 0.12);
    --cat-search: #BFDBFE;
    --cat-search-bg: rgba(147, 197, 253, 0.12);
    --cat-data: #A7F3D0;
    --cat-data-bg: rgba(110, 231, 183, 0.12);
  }
}

  :scope[data-theme="dark"] {
    --text-secondary: #ebe3f6;
    --text-muted: #8A7A9E;
    --code-bg: #1A1230;
    --cat-device: #BAE6FD;
    --cat-device-bg: rgba(125, 211, 252, 0.12);
    --cat-interaction: #ffefb0;
    --cat-interaction-bg: rgba(252, 211, 77, 0.12);
    --cat-form: #FECACA;
    --cat-form-bg: rgba(252, 165, 165, 0.12);
    --cat-search: #BFDBFE;
    --cat-search-bg: rgba(147, 197, 253, 0.12);
    --cat-data: #A7F3D0;
    --cat-data-bg: rgba(110, 231, 183, 0.12);
  }

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

  .bug-guide-card[id] {
    scroll-margin-top: var(--bug-anchor-offset, 9rem);
  }

  body {
    background: var(--ground);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
  }

  /* Base link styling with higher contrast and clear focus/hover indicators */
  a {
    color: var(--primary-dark, var(--accent));
    text-decoration: underline;
    text-underline-offset: 0.15em;
    transition: color 0.15s ease, border-color 0.15s ease;
  }

  a:hover,
  a:focus-visible {
    color: var(--accent-bright);
    text-decoration: none;
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--accent-code);
  }

  .content {
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
  }

  .masthead {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
  }

  .masthead-eyebrow {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
  }

  .masthead h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  .masthead-sub {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 42rem;
    margin: 0 auto 1.25rem;
  }

  h2 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
  }

  .lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 48rem;
    margin: 2rem 0 0.5rem;
  }

  /* ── Table of contents ── */
  .toc {
    margin: 2rem 0 1rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .toc h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
  }

  .toc ol {
    padding-left: 1.5rem;
    margin: 0;
  }

  .toc li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 0.35rem 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .toc a {
    text-decoration: none;
  }

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

  .toc-tag {
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--surface);
    color: var(--accent);
    white-space: nowrap;
  }

  [data-priority="P1"] {
    --priority-bg: #fce9e7;
    --priority-text: #8b3029;
  }

  [data-priority="P2"] {
    --priority-bg: #fff2cc;
    --priority-text: #765300;
  }

  [data-priority="P3"] {
    --priority-bg: #eaf0f5;
    --priority-text: #40566b;
  }

  .priority-badge {
    background: var(--priority-bg);
    color: var(--priority-text);
  }

  .effort-badge {
    background: #e5efff;
    color: #214f96;
    border-color: #8eb3eb;
  }

  :scope[data-theme="dark"] .effort-badge {
    background: #203b60;
    color: #c2dcff;
    border-color: #608bc5;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .effort-badge {
      background: #203b60;
      color: #c2dcff;
      border-color: #608bc5;
    }
}

  .priority-badge,
  .effort-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
  }

  :scope[data-theme="dark"] [data-priority="P1"] {
    --priority-bg: #462c30;
    --priority-text: #ffb9b2;
  }

  :scope[data-theme="dark"] [data-priority="P2"] {
    --priority-bg: #40351f;
    --priority-text: #f2d28b;
  }

  :scope[data-theme="dark"] [data-priority="P3"] {
    --priority-bg: #293743;
    --priority-text: #bacee0;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) [data-priority="P1"] {
      --priority-bg: #462c30;
      --priority-text: #ffb9b2;
    }

    :scope:not([data-theme="light"]) [data-priority="P2"] {
      --priority-bg: #40351f;
      --priority-text: #f2d28b;
    }

    :scope:not([data-theme="light"]) [data-priority="P3"] {
      --priority-bg: #293743;
      --priority-text: #bacee0;
    }
}

  .triage-summary .effort-badge {
    margin-left: 0.4rem;
  }

  .toc-types {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.2rem 0 0.2rem 0.35rem;
    vertical-align: middle;
  }

  .triage-table .toc-types .toc-tag {
    font-size: 0.6rem;
    letter-spacing: 0.04em;
  }

  .triage-summary {
    font-size: 0.78rem;
    color: var(--text-secondary);
  }

  .bug-guide-card>.triage-summary {
    display: inline-block;
    margin: 0 0 0.75rem;
  }

  .triage-prompts {
    margin: 1.5rem 0;
  }

  .triage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
  }

  .triage-actions a {
    display: inline-block;
    padding: 0.65rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-weight: 700;
  }

  .triage-matrix-heading {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 1.75rem 0 1rem;
  }

  .triage-prompts h2,
  .exercise-goal h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--text-primary);
    margin: 0 0 0.75rem;
  }

  .exercise-goal {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    scroll-margin-top: 5rem;
  }

  .triage-prompts ol,
  .exercise-goal ol {
    list-style: none;
    counter-reset: obj;
    padding: 0;
    margin-top: 1.5rem;
    display: grid;
    gap: 0.85rem;
  }

  .triage-prompts ol li,
  .exercise-goal ol li {
    counter-increment: obj;
    position: relative;
    padding: 1rem 1.25rem 1rem 3.25rem;
    background: var(--surface);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
  }

  .triage-prompts ol li::before,
  .exercise-goal ol li::before {
    content: counter(obj);
    position: absolute;
    left: 1rem;
    top: 0.95rem;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--accent-fill);
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    display: grid;
    place-items: center;
  }

  .triage-prompts ol li strong,
  .exercise-goal ol li strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.15rem;
    font-size: 1rem;
  }

  .board-help,
  .board-status {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0.75rem 0;
  }

  .matrix-scroll {
    overflow-x: auto;
    min-width: 0;
  }

  #triage-board,
  .triage-table tr {
    scroll-margin-top: 5rem;
  }

  .effort-matrix.triage-board {
    max-width: none;
    min-width: 550px;
    table-layout: fixed;
  }

  .triage-board th:first-child {
    width: 6rem;
  }

  .triage-board td {
    vertical-align: top;
    text-align: left;
  }

  .board-guidance {
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
  }

  .board-tile {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.4rem;
    text-align: left;

    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .needs-triage {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
  }

  .needs-triage h4 {
    margin: 0;
    color: var(--text-primary);
  }

  .needs-triage>.board-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(0, min(100%, var(--matrix-tile-width, 15rem))));
    gap: 0.5rem;
  }

  .board-tile-content {
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 600;
  }

  .triage-missing {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 0.25rem;
  }

  .triage-missing[hidden] {
    display: none;
  }

  .board-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-secondary);
    width: 2.75rem;
    min-height: 2.75rem;
    font-size: 1.5rem;
    line-height: 1;
    border-radius: 4px;
    user-select: none;
    flex-shrink: 0;
  }

  .board-drag-handle:hover,
  .board-drag-handle:active,
  .board-tile.dragging .board-drag-handle {
    background: #4c167a;
    color: #fff;
  }

  .board-drag-handle:active {
    cursor: grabbing;
  }

  .board-tile.drag-source {
    opacity: 0.45;
  }

  .board-tile.dragging {
    border-color: #8b5bb5;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px #8b5bb5;
  }

  .triage-board td.drop-target,
  .needs-triage.drop-target {
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px var(--accent);
  }

  .triage-board td.quick-win.drop-target {
    box-shadow: inset 0 0 0 3px #2E0A4F, inset 0 0 0 4px #E9D5FF;
  }

  :scope[data-theme="dark"] .triage-board td.quick-win.drop-target {
    box-shadow: inset 0 0 0 3px #E9D5FF;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .triage-board td.quick-win.drop-target {
      box-shadow: inset 0 0 0 3px #E9D5FF;
    }
  }

  .board-tile>a {
    font-size: 0.85rem;
    font-weight: 600;
  }

  .triage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }

  .triage-table th {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-secondary);
  }

  .triage-table th,
  .triage-table td {
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--border-light);
  }

  .triage-table th:first-child {
    width: 100%;
  }

  .triage-value {
    font: inherit;
    font-size: 0.82rem;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.4rem 0.2rem;
    min-height: 2.5rem;
    cursor: pointer;
    max-width: 100%;
  }

  .triage-value:hover {
    background: var(--surface);
    border-color: var(--border-light);
  }

  .triage-value option {
    color: var(--text-primary);
    background: var(--card-bg);
  }

  .triage-table :focus-visible,
  .board-tile :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  @media (max-width: 600px) {
    .triage-table thead {
      display: none;
    }

    .triage-table tr {
      display: grid;
      grid-template-columns: 1fr 1fr;
      padding: 0.6rem 0;
      border-bottom: 1px solid var(--border-light);
    }

    .triage-table td {
      border: 0;
      padding: 0.25rem;
    }

    .triage-table td:first-child {
      grid-column: 1 / -1;
    }

    .triage-table td[data-label]::before {
      content: attr(data-label);
      display: block;
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-bottom: 0.25rem;
    }

    .triage-value {
      width: 100%;
    }
}

  .bug-guide-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
  }

  .bug-guide-filter-row:first-of-type {
    margin-top: 1.25rem;
  }

  .bug-types-help {
    font-size: 0.8rem;
  }

  .bug-guide-filter-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 4.5rem;
  }

  .bug-guide-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .bug-guide-filter {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.4rem 0.85rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }

  .bug-guide-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .bug-guide-filter.active {
    background: var(--accent-fill);
    border-color: var(--accent);
    color: #fff;
  }

  .bug-guide-empty {
    display: none;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    background: var(--surface);
    border-radius: 8px;
    margin-top: 1rem;
  }

  .bug-guide-empty.show {
    display: block;
  }

  .bug-guide-card.hidden {
    display: none;
  }

  .bug-guide-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
  }

  .bug-guide-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px var(--card-shadow);
    border-top: 3px solid var(--bug-guide-color, var(--accent));
  }

  .bug-guide-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
  }

  .bug-guide-card-type {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--bug-guide-bg, var(--severity-major-bg));
    color: var(--bug-guide-color, var(--severity-major));
  }

  .bug-guide-card-type.severity {
    background: var(--surface);
    color: var(--accent);
  }

  .reporter-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0.35rem 0 0.75rem;
  }

  .reporter-line strong {
    color: var(--text-primary);
    font-weight: 700;
  }

  .reporter-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--reporter-color, var(--accent));
    flex-shrink: 0;
  }

  .bug-guide-card h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
  }

  .bug-guide-card-symptom {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-style: italic;
  }

  .bug-guide-address {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.35rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .bug-guide-address dt {
    font-weight: 700;
    color: var(--text-primary);
  }

  .bug-guide-address dd {
    margin: 0;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
  }

  @media (max-width: 400px) {
    .bug-guide-address {
      grid-template-columns: minmax(0, 1fr);
      gap: 0;
    }

    .bug-guide-address dd:not(:last-child) {
      margin-bottom: 0.5rem;
    }
}

  .bug-guide-repro {
    margin: 0 0 1rem;
  }

  .bug-guide-repro img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border-light);
    border-radius: 6px;
  }

  .bug-guide-repro figcaption {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
  }

  .bug-guide-sub {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 1rem 0 0.35rem;
  }

  .bug-guide-sub:first-of-type {
    margin-top: 0;
  }

  .bug-guide-card ol {
    padding-left: 1.25rem;
    margin: 0;
  }

  .bug-guide-card ol li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 0.1rem 0;
  }

  .bug-guide-card .workshop-prompt {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
    /* Adds a subtle structural accent line */
    border-radius: 0 6px 6px 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .bug-guide-card .workshop-prompt strong {
    color: var(--accent);
  }

  .bug-guide-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
  }

  .solution-link {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent);
    border-radius: 100px;
    transition: all 0.15s;
  }

  .solution-link:hover {
    background: var(--accent-fill);
    color: #fff;
  }

  /* Dark Mode Overrides for softer contrast */
  :scope[data-theme="dark"] .bug-guide-card .workshop-prompt {
    background: var(--surface);
    /* Dimmed glow from 0.15 to 0.07 opacity */
    border-left-color: var(--accent-link, var(--accent));
    color: var(--text-secondary);
    /* Keeps prompt text soft (#C4B5D8) */
  }

  :scope[data-theme="dark"] .bug-guide-card .workshop-prompt strong {
    color: var(--accent-link, #D8B4FE);
    /* Ensures the bold key text uses high-contrast lavender */
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .bug-guide-card .workshop-prompt {
      background: var(--surface);
      border-left-color: var(--accent-link, var(--accent));
      color: var(--text-secondary);
    }

    :scope:not([data-theme="light"]) .bug-guide-card .workshop-prompt strong {
      color: var(--accent-link, #D8B4FE);
    }
}

  :scope[data-theme="dark"] .solution-link {
    color: var(--text-muted);
    /* Soft gray-purple (#8A7A9E) */
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .solution-link {
      color: var(--text-muted);
    }

    :scope:not([data-theme="light"]) .solution-link:hover {
      background: rgba(191, 125, 253, 0.436);

    }
}

  @media (max-width: 600px) {
    .masthead {
      padding: 2rem 1rem 1.5rem;
    }

    .content {
      padding: 0 1rem 3rem;
    }

    .bug-guide-filter-label {
      min-width: auto;
    }
}

  /* ── Section nav (sticky) ── */
  .section-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-nav-inner {
    display: flex;
    gap: 0;
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1rem;
  }

  .section-nav a {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.875rem 1rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    flex: 1 0 auto;
    text-align: center;
  }

  .section-nav a:hover,
  .section-nav a:focus-visible {
    color: var(--accent);
    border-bottom-color: var(--accent);
    outline: none;
  }

  /* ── Sections ── */
  section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-light);
    scroll-margin-top: 4rem;
  }

  section:last-child {
    border-bottom: none;
  }

  .section-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
  }

  section>h2 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 1rem;
  }

  section>h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  /* ── Severity guide + Priority × Effort matrix ── */
  .severity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .severity-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .severity-badge {
    flex-shrink: 0;
    width: 5.5rem;
    padding: 0.3rem 0;
    text-align: center;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 4px;
  }

  .severity-badge.critical {
    background: var(--severity-critical-bg);
    color: var(--severity-critical);
  }

  .severity-badge.major {
    background: var(--severity-major-bg);
    color: var(--severity-major);
  }

  .severity-badge.minor {
    background: var(--severity-minor-bg);
    color: var(--severity-minor);
  }

  .severity-content h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
  }

  .severity-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
  }

  .severity-content .examples {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .effort-matrix {
    margin-top: 1.25rem;
    border-collapse: separate;
    border-spacing: 0.35rem;
    width: 100%;
    max-width: 40rem;
  }

  .effort-matrix th,
  .effort-matrix td {
    padding: 0.6rem 0.75rem;
    text-align: center;
    font-size: 0.88rem;
    border-radius: 6px;
  }

  .effort-matrix th {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    font-weight: 600;
  }

  .effort-matrix td {
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .effort-matrix td.quick-win {
    background: #6b21a8;
    color: #ffffff;
    font-weight: 600;
  }

  .effort-matrix td.quick-win>.board-guidance {
    color: #ffffff;
    font-weight: 700;
  }

  .effort-matrix .row-label {
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: right;
    padding-right: 0.9rem;
  }

  /* Sticky Filter Toolbar */
  .bug-filter-toolbar {
    position: sticky;
    top: var(--bug-nav-height, 2.8rem);
    /* Aligns below the measured section navigation, including wrapped text. */
    z-index: 90;
    background: var(--nav-bg, #ffffff);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    padding: 0.65rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .filter-panel-content {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .filter-panel-toggle {
    display: none;
  }

  .filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .filter-label {
    font-family: var(--font-display, sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
  }

  .filter-pills {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
  }

  .filter-divider {
    color: var(--border-light, #cbd5e1);
    font-size: 0.85rem;
    user-select: none;
  }

  .filter-selects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Compact Dropdowns */
  /* Base Dropdown Styling */
  .filter-dropdown {
    font-family: var(--font-display, sans-serif);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-light, #cbd5e1);
    background-color: var(--card-bg, #ffffff);
    color: var(--text-secondary, #334155);
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
  }

  /* Active Selected Dropdown Highlight */
  .filter-dropdown.active {
    border-color: var(--accent, #2563eb);
    background-color: var(--accent-glow, #eff6ff);
    color: var(--accent, #2563eb);
    font-weight: 700;
  }

  /* Ensure options inside dropdown remain readable */
  .filter-dropdown option {
    background: var(--card-bg, #ffffff);
    color: var(--text-primary, #0f172a);
    font-weight: normal;
  }

  .filter-dropdown:hover,
  .filter-dropdown:focus {
    border-color: var(--accent, #2563eb);
  }

  /* Reset / Clear Button */
  .clear-filters-btn {
    background: none;
    border: none;
    color: var(--accent, #2563eb);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
  }

  .clear-filters-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    text-decoration: underline;
  }

  /* Hidden elements */
  .bug-guide-card.hidden {
    display: none !important;
  }

  .triage-table tbody tr.filtered-out {
    display: none !important;
  }

  #bug-directory-list .triage-table[hidden] { display: none !important; }
  #bug-guide-empty .clear-filters-btn {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: transparent;
    font-style: normal;
  }
  #bug-guide-empty .clear-filters-btn:hover {
    background: var(--accent-glow);
    text-decoration: none;
  }
  #bug-guide-empty .clear-filters-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  .triage-table tbody tr.filtered-out .triage-value {
    pointer-events: none;
  }

  /* Card visibility */
  .bug-guide-card.hidden {
    display: none !important;
  }

  /* Status counter */
  .filter-status {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: normal;
  }

  .filter-status.is-filtered {
    padding: 0.35rem 0.65rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
  }

  .filter-results-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
  .mobile-filter-status { display: none; }
  #active-filter-summary:not([hidden]) { margin-bottom: 0.2rem; }

  .bug-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
  }
  .bug-filter-check input { margin: 0; accent-color: var(--accent); }
  .bug-filter-check:has(input:checked) {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--card-bg));
    color: var(--accent);
  }
  .bug-filter-check:hover { border-color: var(--accent); }
  .bug-filter-check:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

  #active-filter-summary:not([hidden]) { display: block; }
  #starter-bugs-help[hidden] { display: none; }
  #starter-bugs-help { flex-basis: 100%; margin: 0; }
  .starter-bug-badge.toc-tag,
  .starter-bug-badge.bug-guide-card-type {
    display: inline-block;
    margin: 0;
    background: var(--accent-fill);
    color: #FFFFFF;
    border: 1px solid var(--accent);
    vertical-align: middle;
  }

  :scope[data-theme="dark"] .starter-bug-badge.toc-tag,
  :scope[data-theme="dark"] .starter-bug-badge.bug-guide-card-type {
    background: var(--accent-fill);
    border-color: var(--accent-fill-border);
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .starter-bug-badge.toc-tag,
    :scope:not([data-theme="light"]) .starter-bug-badge.bug-guide-card-type {
      background: var(--accent-fill);
      border-color: var(--accent-fill-border);
    }
  }

  .filter-status strong {
    color: var(--accent);
  }

  .bug-guide-card-type.cat-css,
  .toc-tag.cat-css {
    background: var(--cat-css-bg);
    color: var(--cat-css);
  }

  .bug-guide-card-type.cat-device,
  .toc-tag.cat-device {
    background: var(--cat-device-bg);
    color: var(--cat-device);
  }

  .bug-guide-card-type.cat-interaction,
  .toc-tag.cat-interaction {
    background: var(--cat-interaction-bg);
    color: var(--cat-interaction);
  }

  .bug-guide-card-type.cat-form,
  .toc-tag.cat-form {
    background: var(--cat-form-bg);
    color: var(--cat-form);
  }

  .bug-guide-card-type.cat-search,
  .toc-tag.cat-search {
    background: var(--cat-search-bg);
    color: var(--cat-search);
  }

  .bug-guide-card-type.cat-data,
  .toc-tag.cat-data {
    background: var(--cat-data-bg);
    color: var(--cat-data);
  }

  .bug-guide-card-type,
  .toc-tag {
    border: 1px solid var(--cat-tag-border, transparent);
    transition: border-color 0.15s ease;
  }

  :scope[data-theme="dark"] .bug-guide-card-type,
  :scope[data-theme="dark"] .toc-tag {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
  }

  @media (prefers-color-scheme: dark) {

    :scope:not([data-theme="light"]) .bug-guide-card-type,
    :scope:not([data-theme="light"]) .toc-tag {
      border-color: color-mix(in srgb, currentColor 30%, transparent);
    }
}

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) {
      /* Use a brighter purple/pink in dark mode for a higher contrast ratio */
      --accent-link: var(--accent-text);
      --text-muted: #A190B8;
      /* Slightly lighter muted text for better readability */
    }
}

  :scope[data-theme="dark"] {
    --accent-link: var(--accent-text);
    --text-muted: #A190B8;
  }

  /* Apply the dark-mode accessible link variable */
  a {
    color: var(--accent-link, var(--accent));
  }

  /* Unselected State: Muted, italic text with a subtle solid outline */
  .triage-value:has(option:checked[value=""]) {
    color: var(--text-muted);
    font-style: italic;
    background: transparent;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
  }

  /* Hover/Focus refinement for unselected inputs */
  .triage-value:has(option:checked[value=""]):hover {
    border-color: var(--accent);
    color: var(--text-secondary);
  }

  .triage-table th:first-child {
    width: auto;
  }

  .triage-table th:nth-child(2),
  .triage-table td:nth-child(2),
  .triage-table th:nth-child(3),
  .triage-table td:nth-child(3) {
    min-width: 7.5rem;
    white-space: nowrap;
  }

  .triage-value {
    width: 100%;
  }

  /* Floating drawer toggle (small / split viewports) */
  .toc-drawer-toggle {
    display: inline-flex;
    width: 4rem;
    height: 7.5rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 0;
    bottom: auto;
    right: auto;
    z-index: 150;
    background: var(--accent, #2563eb);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.75rem 0.25rem;
    border: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;

    /* Hidden state before scrolling past inline TOC */
    opacity: 0;
    pointer-events: none;
    transform: translate(-100%, -50%);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  /* Revealed when scrolled past the inline TOC */
  .toc-drawer-toggle.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
  }

  .drawer-tab-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
  }

  .drawer-tab-icon-frame {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    font-size: 1.5rem;
    line-height: 1;
  }

  .drawer-tab-arrow {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
  }

  .sidebar-title {
  font-family: var(--font-display, sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary, #0f172a);
  margin: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.close-drawer-btn {
  display: grid;
  place-items: center;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.close-drawer-btn:hover,
.close-drawer-btn:focus-visible {
  border-color: var(--accent);
  background: var(--accent-fill);
  color: #ffffff;
}

.close-drawer-btn:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.toc-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-link {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-secondary, #475569);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.toc-link:hover,
.toc-link:focus-visible {
  background: var(--accent-glow, #eff6ff);
  color: var(--accent, #2563eb);
}

.toc-link[aria-current="location"] {
  border-left: 3px solid var(--accent, #2563eb);
  background: var(--accent-glow, #eff6ff);
  color: var(--accent, #2563eb);
  font-weight: 700;
}

.toc-bug-id {
  font-family: var(--font-display, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  background: var(--surface, #f1f5f9);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.toc-link:hover .toc-bug-id {
  color: var(--accent, #2563eb);
  background: var(--card-bg, #ffffff);
}

.toc-bug-id.priority-badge,
.toc-link:hover .toc-bug-id.priority-badge {
  color: var(--priority-text);
  background: var(--priority-bg);
}

/* Off-canvas Drawer Panel Sliding from the Left */
.bug-guide-sidebar {
  position: fixed;
  top: var(--site-header-height, 3.25rem);
  left: -280px; /* Hidden off the left edge */
  width: 260px;
  height: calc(100vh - var(--site-header-height, 3.25rem));
  z-index: 200;
  background: var(--card-bg, #ffffff);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15); /* Shadow extends to the right */
  padding: 1.25rem;
  transition: left 0.25s ease-in-out;
  overflow-y: auto;
}

/* Drawer Open State */
.bug-guide-sidebar.open {
  left: 0 !important; /* Slide in from left */
}

/* Overlay Backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 3.25rem 0 0;
  z-index: 190;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block !important;
}

@media (max-width: 1439px) {
  .toc-drawer-toggle,
  .bug-guide-sidebar,
  .sidebar-overlay {
    display: none !important;
  }
}

/* --- LARGE VIEWPORTS (>= 1440px) --- */
@media (min-width: 1440px) {
  .toc-drawer-toggle,
  .sidebar-header,
  .sidebar-overlay {
    display: none !important;
  }

  .bug-guide-sidebar {
    position: fixed;
    top: calc(var(--site-header-height, 5rem) + 1rem);
    left: calc(50vw - 32rem - 200px);
    width: 180px;
    height: auto;
    max-height: calc(100vh - var(--site-header-height, 5rem) - 2rem);
    box-shadow: none;
    background: transparent;
    padding: 0;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-0.75rem);
    transition: opacity 0.28s ease, transform 0.28s ease;
  }

  .bug-guide-sidebar.past-toc {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }
}

@media (max-width: 767px) {
  .bug-filter-toolbar {
    display: block;
    padding: 0.5rem 1rem;
  }
  .mobile-filter-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.35rem; padding: 0 0.75rem; font-size: 0.82rem; color: var(--text-secondary); }
  .filter-status .filter-results-line { display: none; }
  #active-filter-summary:not([hidden]) { display: none; }
  .filter-status { display: none; }
  .filter-status.is-filtered { padding: 0; border: 0; background: transparent; }

  .filter-panel-toggle {
    display: flex;
    width: 100%;
    min-height: 2.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }

  .filter-panel-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .filter-panel-chevron {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .filter-panel-toggle[aria-expanded="true"] .filter-panel-chevron {
    transform: rotate(180deg);
  }

  .filter-panel-content {
    display: none;
    padding: 0.75rem 0.25rem 0.25rem;
  }

  .filter-panel-toggle[aria-expanded="true"] + .filter-panel-content {
    display: flex;
  }

  .filter-panel-content,
  .filter-group {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-group {
    gap: 0.65rem;
  }

  .filter-divider {
    display: none;
  }

  .filter-pills {
    display: flex;
    flex-wrap: wrap;
  }

  .filter-status {
    padding-top: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bug-guide-sidebar,
  .filter-panel-chevron {
    transition: none;
  }
}
}

/* Shared Workshop Guide and Reference styles. Keep their common components together. */
@scope (html:is([data-page="index"], [data-page="recap"])) {
/* ── Fonts ── */
  :scope {
    --success: #16A34A;
    --accent-link: #6D28A9;
    --accent-text: #7B2FBE;
  }

  /* ── Dark palette (system preference, no explicit stamp) ── */
  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) {
    --surface-alt: #221845;
    --text-secondary: #D6CBE5;
    --text-muted: #A190B8;
    --setup-glow: var(--surface);
    --severity-critical: #FF6B7A;
    --severity-major: #FFB84D;
    --severity-minor: #38D9D2;
    --role-dev: #B77CFF;
    --role-pm: #FF7BC5;
    --role-lead: #6EA8FF;
    --role-qa: #38D9D2;
    --role-director: #C084FC;
    --role-support: #FFB454;
    --role-design: #F0A3CF;
    --code-bg: #0a0518c2;
    --success: #4ADE80;
    --accent-link: var(--accent-text);
    --accent-text: #D1A4FF;
  }
}

  /* ── Dark palette (explicit toggle) ── */
  :scope[data-theme="dark"] {
    --surface-alt: #221845;
    --text-secondary: #D6CBE5;
    --text-muted: #A190B8;
    --setup-glow: var(--surface);
    --severity-critical: #FF6B7A;
    --severity-major: #FFB84D;
    --severity-minor: #38D9D2;
    --role-dev: #B77CFF;
    --role-pm: #FF7BC5;
    --role-lead: #6EA8FF;
    --role-qa: #38D9D2;
    --role-director: #C084FC;
    --role-support: #FFB454;
    --role-design: #F0A3CF;
    --code-accent: var(--accent-text);
    --code-bg: #0a0518c2;
    --success: #4ADE80;
    --accent-link: var(--accent-text);
    --accent-text: #D1A4FF;
  }

  /* ── Global link treatment ── */
  a {
    color: var(--accent-link, var(--accent));
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
  }

  a:hover,
  a:focus-visible {
    color: var(--accent-bright);
  }

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

  section[id] {
    scroll-margin-top: 3.5rem;
  }

  body {
    background: var(--ground);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
  }

  /* ── Masthead ── */
  .masthead {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
  }

  .masthead-eyebrow {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
  }

  .masthead h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    text-wrap: balance;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  .masthead h1 em {
    font-style: normal;
    color: var(--accent-bright);
  }

  .masthead-sub {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 38rem;
    margin: 0 auto 1.25rem;
  }

  .masthead-meta {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .masthead-meta span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-fill);
    margin-right: 0.5rem;
    vertical-align: middle;
  }

  /* ── Materials CTA cards ── */
  .materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .material-card {
    display: block;
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--card-shadow);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  }

  .material-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--card-shadow);
    border-left-color: var(--accent-bright);
  }

  .material-card-eyebrow {
    font-family: var(--font-display);
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
  }

  .material-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.35rem;
  }

  .material-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
  }

  /* ── Sticky nav ── */
  .section-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-nav-inner {
    display: flex;
    gap: 0;
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1rem;
  }

  .section-nav a {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.875rem 1rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    flex: 1 0 auto;
    text-align: center;
  }

  .section-nav a:hover,
  .section-nav a:focus-visible {
    color: var(--accent);
    border-bottom-color: var(--accent);
    outline: none;
  }

  /* ── Layout ── */
  .content {
    max-width: 64rem;
    margin: 0 auto;
    padding: 0 1.5rem;
  }

  section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-light);
    scroll-margin-top: 4rem;
  }

  section:last-child {
    border-bottom: none;
  }

  .section-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin-bottom: 0.5rem;
  }

  h2 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    line-height: 1.2;
    text-wrap: balance;
    color: var(--text-primary);
    margin-bottom: 1rem;
  }

  h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
  }

  p + p {
    margin-top: 0.75rem;
  }

  .lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 48rem;
    margin-bottom: 1.5rem;
  }

  /* ── Timeline ── */
  .timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .timeline-step {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .timeline-step-time {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.35rem;
  }

  .timeline-step h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
  }

  .timeline-step p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
  }

  /* ── Role cards ── */
  .roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .role-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--card-shadow);
    border-left: 4px solid var(--role-color, var(--accent));
  }

  .role-card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--role-color, var(--accent));
    margin-bottom: 0.15rem;
  }

  .role-card-vibe {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
  }

  .role-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
  }

  .role-card-focus {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
  }

  .role-card-focus-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
  }

  .role-card blockquote {
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--accent-glow);
    border-radius: 6px;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-secondary);
  }

  .role-card blockquote::before {
    content: '"';
    font-size: 1.2rem;
    color: var(--accent);
    margin-right: 0.15rem;
  }

  /* ── Severity guide ── */
  .severity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .severity-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .severity-badge {
    flex-shrink: 0;
    width: 5.5rem;
    padding: 0.3rem 0;
    text-align: center;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 4px;
  }

  .severity-badge.critical {
    background: var(--severity-critical-bg);
    color: var(--severity-critical);
  }

  .severity-badge.major {
    background: var(--severity-major-bg);
    color: var(--severity-major);
  }

  .severity-badge.minor {
    background: var(--severity-minor-bg);
    color: var(--severity-minor);
  }

  .severity-content h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
  }

  .severity-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
  }

  .severity-content .examples {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  /* ── Bug categories ── */
  .bug-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .bug-cat {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px var(--card-shadow);
    text-align: center;
  }

  .bug-cat-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .bug-cat h3 {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 0.35rem;
  }

  .bug-cat p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
  }

  /* ── Setup steps ── */
  .setup-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    counter-reset: step;
  }

  .setup-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
  }

  .setup-step::before {
    counter-increment: step;
    content: counter(step);
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-fill);
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 50%;
  }

  .setup-step-content h3 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
  }

  .setup-step-content p {
    font-size: 0.92rem;
    color: var(--text-secondary);
  }

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--code-accent);
  }

  /* ── Prompting framework (Brief · Audit · Own) ── */
  .prompt-framework-intro {
    margin-top: 1.75rem;
    font-size: 0.98rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .prompt-framework-intro strong {
    color: var(--text-primary);
  }

  .prompt-framework-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }

  .prompt-framework-card {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .prompt-framework-num {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--accent-bright);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
  }

  .prompt-framework-card h3 {
    font-size: 1.05rem;
    margin: 0 0 0.6rem;
    color: var(--text-primary);
  }

  .prompt-framework-card ul {
    margin: 0;
    padding-left: 1.15rem;
  }

  .prompt-framework-card li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
    padding: 0.15rem 0;
  }

  /* ── AI tips ── */
  .ai-tips {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }

  .ai-tip {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .ai-tip h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.35rem;
  }

  .ai-tip p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .ai-tip .prompt-example {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
  }

  /* ── Hints callout ── */
  .hints-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .hint-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
  }

  .hint-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 0.1rem;
  }

  .hint-text {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
  }

  .hint-text strong {
    color: var(--text-primary);
  }

  /* ── Bug-Busting Mindset ── */
  .mindset-tagline,
  .objectives-tagline {
    margin-top: 1rem;
    padding: 0.9rem 1.25rem;
    background: var(--accent-glow);
    border-left: 3px solid var(--accent-bright);
    border-radius: 6px;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--text-primary);
  }

  .mindset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .pillar-card {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 3px var(--card-shadow);
  }

  .pillar-card-num {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--accent-bright);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
  }

  .pillar-card h3 {
    font-size: 1.05rem;
    margin: 0 0 0.35rem;
    color: var(--text-primary);
  }

  .pillar-card-subtitle {
    font-style: italic;
    font-size: 0.98rem;
    color: var(--accent);
    margin: 0 0 0.5rem;
  }

  .pillar-card p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
  }

  /* ── Workshop Goals ── */
  .goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .goal-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border-radius: 10px;
  }

  .goal-icon {
    flex-shrink: 0;
    font-size: 1.6rem;
    line-height: 1;
    margin-top: 0.1rem;
  }

  .goal-card h3 {
    font-size: 0.98rem;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
  }

  .goal-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
  }

  /* ── Priority × Effort matrix ── */
  .effort-matrix {
    margin-top: 1.25rem;
    border-collapse: separate;
    border-spacing: 0.35rem;
    width: 100%;
    max-width: 40rem;
  }

  .effort-matrix th,
  .effort-matrix td {
    padding: 0.6rem 0.75rem;
    text-align: center;
    font-size: 0.88rem;
    border-radius: 6px;
  }

  .effort-matrix th {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    font-weight: 600;
  }

  .effort-matrix td {
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.35;
  }

  .effort-matrix td.quick-win {
    background: var(--accent-fill);
    color: #ffffff;
    font-weight: 600;
  }

  .effort-matrix .row-label {
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: right;
    padding-right: 0.9rem;
  }

  /* ── Objectives list ── */
  .objectives-list {
    list-style: none;
    counter-reset: obj;
    padding: 0;
    margin-top: 1.5rem;
    display: grid;
    gap: 0.85rem;
  }

  #exercise .objectives-list + .lead {
    margin-top: 1.5rem;
  }

  .objectives-list li {
    counter-increment: obj;
    position: relative;
    padding: 1rem 1.25rem 1rem 3.25rem;
    background: var(--surface);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
  }

  .objectives-list li::before {
    content: counter(obj);
    position: absolute;
    left: 1rem;
    top: 0.95rem;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--accent-fill);
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    display: grid;
    place-items: center;
  }

  .objectives-list li strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.15rem;
    font-size: 1rem;
  }

  /* ── AI split (excels vs needs push) ── */
  .ai-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .ai-split-card {
    padding: 1rem 1.1rem;
    background: var(--surface);
    border-radius: 8px;
  }

  .ai-split-card h3 {
    font-size: 0.92rem;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
  }

  .ai-split-card ul {
    margin: 0;
    padding-left: 1.1rem;
  }

  .ai-split-card li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.25rem;
  }

  @media (max-width: 640px) {
    .ai-split {
      grid-template-columns: 1fr;
    }

    .effort-matrix {
      font-size: 0.8rem;
    }
}

  /* ── Setup sub-headings ── */
  .setup-subhead {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 0.35rem;
  }

  .setup-subhead:first-of-type {
    margin-top: 1rem;
  }

  /* ── Supplies ── */
  .supplies-row {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
  }

  .supplies-col h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
  }

  .supplies-col ul {
    list-style: none;
    padding: 0;
  }

  .supplies-col li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    padding: 0.2rem 0;
    padding-left: 1.25rem;
    position: relative;
  }

  .supplies-col li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
  }

  /* ── Closing ── */
  .closing {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
  }

  .closing-mantras {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;

  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.closing-mantra {
  position: relative;
  padding-left: 1rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.closing-mantra::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent-bright);
}

@media (max-width: 600px) {
  .closing-mantras {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
}

  /* ── Bug guide filters ── */
  .bug-guide-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
  }

  .bug-guide-filter-row:first-of-type {
    margin-top: 1.25rem;
  }

  .bug-guide-filter-label {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 4.5rem;
  }

  .bug-guide-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .bug-guide-filter {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.4rem 0.85rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
  }

  .bug-guide-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .bug-guide-filter.active {
    background: var(--accent-fill);
    border-color: var(--accent);
    color: #fff;
  }

  .bug-guide-empty {
    display: none;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    background: var(--surface);
    border-radius: 8px;
    margin-top: 1rem;
  }

  .bug-guide-empty.show {
    display: block;
  }

  .bug-guide-card.hidden {
    display: none;
  }

  /* ── Bug guide cards ── */
  .bug-guide-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
  }

  .bug-guide-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px var(--card-shadow);
    border-top: 3px solid var(--bug-guide-color, var(--accent));
  }

  .bug-guide-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
  }

  .bug-guide-card-type {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: var(--bug-guide-bg, var(--severity-major-bg));
    color: var(--bug-guide-color, var(--severity-major));
  }

  .bug-guide-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.1rem;
  }

  .bug-guide-card-symptom {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    font-style: italic;
  }

  .bug-guide-sub {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    margin-top: 1rem;
  }

  .bug-guide-sub:first-of-type {
    margin-top: 0;
  }

  .bug-guide-card ol {
    padding-left: 1.25rem;
    margin: 0;
  }

  .bug-guide-card ol li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 0.1rem 0;
  }

  .bug-guide-card .workshop-prompt {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--accent-glow);
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .bug-guide-card .workshop-prompt strong {
    color: var(--accent);
  }

  /* ── Inline form controls ── */
  .setup-step-content input[type="number"] {
    color: var(--text-primary);
    background: var(--card-bg);
    border-color: var(--border);
    color-scheme: light;
  }

  :scope[data-theme="dark"] .setup-step-content input[type="number"] {
    color-scheme: dark;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .setup-step-content input[type="number"] {
      color-scheme: dark;
    }
}

  /* ── Setup formatting ── */

.setup-step-content h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0.15rem 0 0.5rem;
}

.setup-step-content h5 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0.15rem 0 0.5rem;
}

.setup-option {
  margin-top: 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.setup-option + .setup-option {
  margin-top: 1rem;
}

.setup-option-label,
.setup-path-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.table-launcher {
  margin-top: 0.85rem;
  padding: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}

.table-launcher-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.table-launcher-row label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.table-launcher-row input {
  width: 70px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.table-launcher-row button {
  background: var(--accent-fill);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.table-launcher-row button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.table-launcher-alt {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.table-input-error {
  display: none;
  color: var(--severity-critical);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.4rem;
}

.header-controls-guide {
  margin: 1.25rem 0 0.5rem;
}

.header-controls-guide img {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.header-controls-guide figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.setup-note {
  margin-top: 0.7rem !important;
  font-size: 0.84rem !important;
  color: var(--text-muted) !important;
  line-height: 1.5 !important;
}

.setup-path {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 7px;
}

.setup-path p {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.setup-path pre {
  margin-top: 0.6rem;
}

.setup-connect {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--setup-glow, var(--accent-glow));
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.setup-connect ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.setup-connect li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0.25rem 0;
}

/* Optional setup troubleshooting */
.setup-troubleshooting {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff8e8;
  color: #573a0c;
  border: 1px solid #e6c779;
  border-left: 4px solid #ad720b;
  border-radius: 8px;
  scroll-margin-top: 4rem;
}

.setup-step-content .setup-troubleshooting h4 {
  color: inherit;
  margin: 0 0 0.5rem;
}

.setup-step-content .setup-troubleshooting p {
  color: inherit;
  font-size: 0.9375rem;
  margin: 0 0 0.5rem;
}

.setup-step-content .setup-troubleshooting p:last-child { margin-bottom: 0; }

:scope[data-theme="dark"] .setup-troubleshooting {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: #C89B73;
}

:scope[data-theme="dark"] .setup-step-content .setup-troubleshooting h4 {
  color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :scope:not([data-theme="light"]) .setup-troubleshooting {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: #C89B73;
  }
  :scope:not([data-theme="light"]) .setup-step-content .setup-troubleshooting h4 {
    color: var(--text-primary);
  }
}

.setup-callout {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--accent-glow);
  border-left: 3px solid var(--accent-bright);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.setup-control-group > :last-child {
  margin-bottom: 0;
}

.setup-control-group .header-controls-guide {
  margin-top: 0.75rem;
}

.setup-callout strong {
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .table-launcher-row {
    align-items: stretch;
  }

  .table-launcher-row button {
    width: 100%;
  }

  .table-launcher-alt {
    width: 100%;
    margin-top: 0.15rem;
  }
}

  /* ── Responsive ── */
  @media (max-width: 600px) {
    .masthead {
      padding: 2rem 1rem 1.5rem;
    }

    .masthead-meta {
      flex-direction: column;
      gap: 0.5rem;
      align-items: center;
    }

    .severity-row {
      flex-direction: column;
    }

    .severity-badge {
      width: auto;
      align-self: flex-start;
    }

    .roles-grid {
      grid-template-columns: 1fr;
    }

    .timeline {
      grid-template-columns: 1fr;
    }

    section {
      padding: 2rem 0;
    }

    .content {
      padding: 0 1rem;
    }
}
}

@scope (html[data-page="solutions"]) {
:scope {
    --success: #16A34A;
    --diff-add-bg: #E6F9EC;
    --diff-add-text: #166534;
    --diff-remove-bg: #FFF0F1;
    --diff-remove-text: #991B1B;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) {
    --text-secondary: #ebe3f6;
    --text-muted: #8A7A9E;
    --code-bg: #1A1230;
    --diff-add-bg: #0F2A18;
    --diff-add-text: #86EFAC;
    --diff-remove-bg: #2A0F13;
    --diff-remove-text: #FCA5A5;
  }
}

  :scope[data-theme="dark"] {
    --text-secondary: #ebe3f6;
    --text-muted: #8A7A9E;
    --code-bg: #1A1230;
    --diff-add-bg: #0F2A18;
    --diff-add-text: #86EFAC;
    --diff-remove-bg: #2A0F13;
    --diff-remove-text: #FCA5A5;
    --code-accent: var(--accent-text);
  }

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

  .solution[id] { scroll-margin-top: 1rem; }

  body { background: var(--ground); color: var(--text-primary); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.7; -webkit-font-smoothing: antialiased; }

  a {
    color: var(--accent-link, var(--accent));
    text-decoration: underline;
    text-underline-offset: 0.15em;
    transition: color 0.15s ease, border-color 0.15s ease;
  }

  code { font-family: var(--font-mono); font-size: 0.85em; background: var(--code-bg); padding: 0.15em 0.4em; border-radius: 4px; color: var(--accent); }

  pre { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55; background: var(--code-bg); color: var(--text-primary); padding: 0.9rem 1rem; border-radius: 6px; overflow-x: auto; margin: 0.5rem 0; }

  /* As wide as the longest line, so diff highlights span the full scroll width. */
  pre code { display: inline-block; min-width: 100%; background: none; padding: 0; color: inherit; font-size: inherit; }

  /* Full-width highlight whose text stays aligned with unchanged lines: the
     padding is offset by an equal negative margin. Inline-block (not block)
     so the newline after each highlighted line doesn't add a blank line. */
  .diff-add, .diff-remove { display: inline-block; width: calc(100% + 0.8em); margin: 0 -0.4em; padding: 0 0.4em; vertical-align: top; }

  .diff-add { background: var(--diff-add-bg); color: var(--diff-add-text); }

  .diff-remove { background: var(--diff-remove-bg); color: var(--diff-remove-text); text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.2); }

  .content { max-width: 60rem; margin: 0 auto; padding: 0 1.5rem 4rem; }

  .masthead { padding: 3rem 1.5rem 2rem; text-align: center; border-bottom: 1px solid var(--border-light); }

  .masthead-eyebrow { font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; }

  .masthead h1 { font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.15; color: var(--text-primary); margin-bottom: 0.5rem; }

  .masthead-sub { font-size: 1.125rem; color: var(--text-secondary); max-width: 42rem; margin: 0 auto 1.25rem; }

  .notice { margin: 2rem 0; padding: 1rem 1.25rem; background: var(--surface); border-left: 3px solid var(--accent); border-radius: 6px; font-size: 0.92rem; color: var(--text-secondary); }

  .notice strong { color: var(--accent); }

  .toc { margin: 2rem 0 3rem; padding: 1.5rem; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 8px; box-shadow: 0 1px 3px var(--card-shadow); }

  .toc h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }

  .toc ol { padding-left: 1.5rem; margin: 0; }

  .toc li { font-size: 0.95rem; color: var(--text-secondary); padding: 0.35rem 0; }

  .toc a { text-decoration: none; }

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

  .solution { margin: 3rem 0; padding: 2rem; background: var(--card-bg); border: 1px solid var(--border-light); border-radius: 8px; box-shadow: 0 1px 3px var(--card-shadow); border-top: 3px solid var(--accent); }

  .solution-tag { display: inline-block; font-family: var(--font-display); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: 4px; background: var(--surface); color: var(--accent); margin-bottom: 0.5rem; }

  .solution h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.35rem; }

  /* End-of-solution link back to its bug, matching the Bug Report's
     "View full solution" pill. */
  .solution-footer { display: flex; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-light); }
  .solution-footer-link { font-family: var(--font-display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); text-decoration: none; padding: 0.5rem 1rem; border: 1px solid var(--accent); border-radius: 100px; transition: background-color 0.15s ease, color 0.15s ease; }
  .solution-footer-link:hover { background: var(--accent-fill); color: #ffffff; }
  .solution-footer-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Link to this solution's own bug in the Bug Report. */
  .solution-bug-link { display: inline-block; margin-top: 0.15rem; font-size: 0.9rem; font-weight: 700; color: var(--accent-link, var(--accent)); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

  .solution-bug-link:hover { color: var(--accent-bright, var(--accent)); text-decoration-thickness: 2px; }

  .solution-section-label { font-family: var(--font-display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); margin: 1.5rem 0 0.35rem; }

  .solution p { color: var(--text-secondary); font-size: 0.98rem; margin: 0.35rem 0; }

  .solution ul { padding-left: 1.25rem; margin: 0.5rem 0; }

  .solution ul li { color: var(--text-secondary); font-size: 0.95rem; padding: 0.15rem 0; }

  .solution .file-path { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; overflow-wrap: anywhere; }

  @media (max-width: 600px) {
    .masthead { padding: 2rem 1rem 1.5rem; }

    .content { padding: 0 1rem 3rem; }

    .solution { padding: 1.25rem; }
}

  code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: var(--code-accent); /* Updated from var(--accent) */
  }

  :scope[data-theme="dark"] .notice {
    background: var(--surface);
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) {
      /* Use a brighter purple/pink in dark mode for a higher contrast ratio */
      --accent-link: var(--accent-text);
      --text-muted: #A190B8; /* Slightly lighter muted text for better readability */
    }
}

  :scope[data-theme="dark"] {
    --accent-link: var(--accent-text);
    --text-muted: #A190B8;
  }

  .toc {
  margin: 2rem 0 3rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--card-shadow);
}

.toc h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.toc ol {
  padding-left: 1.5rem;
  margin: 0;
}

.toc li {
  font-size: 0.95rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
}
}

/* Mobile triage: edit in the directory, read assignments by priority. */
html[data-page="bugs"] .triage-touch-copy,
html[data-page="bugs"] .matrix-effort-label { display: none; }

@media (max-width: 700px), (pointer: coarse) {
  html[data-page="bugs"] .board-drag-handle,
  html[data-page="bugs"] .triage-pointer-copy { display: none; }

  html[data-page="bugs"] .triage-touch-copy { display: inline; }
}

@media (max-width: 700px) {
  html[data-page="bugs"] .effort-matrix.triage-board { display: block; width: 100%; min-width: 0; border-spacing: 0; }

  html[data-page="bugs"] .triage-board thead { display: none; }

  html[data-page="bugs"] .triage-board tbody { display: block; }

  html[data-page="bugs"] .triage-board tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; margin-bottom: 1.25rem; }

  html[data-page="bugs"] .triage-board th.row-label { display: block; width: auto; text-align: left; padding: 0.5rem 0; }

  html[data-page="bugs"] .triage-board td { display: block; width: auto; min-width: 0; height: auto; padding: 0.75rem; }

  html[data-page="bugs"] .matrix-effort-label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 0.35rem; }

  html[data-page="bugs"] .needs-triage > .board-tiles { grid-template-columns: minmax(0, 1fr); }

  html[data-page="bugs"] .board-tile-content { overflow-wrap: anywhere; }
}


/* Optional, progressively disclosed help stays with its bug report. */
@scope (html[data-page="bugs"]) {
  /* Optional guidance shares the "Stuck?" banner style. */
  .hints-intro,
  .exercise-tip {
    padding: 0.85rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
    color: var(--text-primary);
  }

  .exercise-goal ol + p,
  .exercise-goal p + .exercise-tip {
    margin-top: 1.5rem;
  }

  .bug-hints {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--ground);
    color: var(--text-primary);
  }

  .bug-hints summary {
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.5;
    padding: 0.35rem 0;
  }

  .bug-hints summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
  }

  .bug-hints .hints-help {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.65rem 0;
  }

  .bug-hint {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0;
  }

  .bug-hint[hidden] { display: none; }
  .bug-hint p { margin: 0.5rem 0; line-height: 1.65; }
}


@scope (html[data-page="bugs"]) {
  .exercise-notice {
    --notice-bg: #fff8e6;
    --notice-border: #b77900;
    --notice-text: #624000;
    padding: 1rem 1.15rem;
    margin: 1rem 0;
    border: 1px solid var(--notice-border);
    border-left-width: 5px;
    border-radius: 6px;
    background: var(--notice-bg);
    color: var(--notice-text);
    line-height: 1.65;
  }

  .exercise-notice-label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  :scope[data-theme="dark"] .exercise-notice {
    --notice-bg: var(--surface);
    --notice-border: #dca642;
    --notice-text: #ffe1a3;
  }

  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .exercise-notice {
      --notice-bg: var(--surface);
      --notice-border: #dca642;
      --notice-text: #ffe1a3;
    }
  }
}

/* Rows in the bug list land below the header and the pinned filter bar;
   everything else only needs to clear the header. */
html[data-page="bugs"] .triage-table tr {
  scroll-margin-top: var(--bug-anchor-offset, 9rem);
}

html[data-page="bugs"] :is(#triage-board, #quick-links, #solve-bugs) {
  scroll-margin-top: calc(var(--site-header-height, 4rem) + 1rem);
}

/* The filter toolbar shares a wrapper (.directory-sticky-scope) with the bug
   list + report viewer, so it stays pinned only while the list is on screen.
   The directory intro, toolbar, and list + viewer join into a single box. */
html[data-page="bugs"] .directory-intro { margin-bottom: 0; border-bottom: 0; border-radius: 8px 8px 0 0; padding-bottom: 0.5rem; box-shadow: none; }
html[data-page="bugs"] #bug-filter-toolbar { margin-top: 0; margin-bottom: 0; border-left: 1px solid var(--border-light); border-right: 1px solid var(--border-light); }
html[data-page="bugs"] .directory-layout { margin-bottom: 1rem; padding: 1.5rem; background: var(--card-bg); border: 1px solid var(--border-light); border-top: 0; border-radius: 0 0 8px 8px; box-shadow: 0 1px 3px var(--card-shadow); }
html[data-page="bugs"] .directory-layout .directory-list { margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
/* Past the end of the list the filter bar scrolls away with the content:
   app.js sets --filter-shift (0 or negative px) to move it, and the report
   viewer pinned beside the list, up as the reader keeps scrolling. */
html[data-page="bugs"] #bug-filter-toolbar { top: calc(var(--bug-nav-height, 2.8rem) + var(--filter-shift, 0px)); }
@media (min-width: 901px) {
  html[data-page="bugs"] .directory-sticky-scope .report-viewer { top: max(calc(var(--site-header-height, 4rem) + 0.75rem), calc(var(--bug-anchor-offset, 9rem) - 0.5rem + var(--filter-shift, 0px))); }
}

/* Bug Directory list + report viewer (enabled by app.js). */
@scope (html[data-page="bugs"]) {
  /* Two columns while a report is open; the full-width table otherwise. */
  .directory-layout.is-split { display: grid; grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }

  /* The list is narrow beside the viewer, so stack each row's fields. */
  .is-split .triage-table thead { display: none; }
  .is-split .triage-table tr { display: grid; grid-template-columns: 1fr 1fr; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-light); border-left: 3px solid transparent; }
  .is-split .triage-table td { border: 0; padding: 0.2rem; min-width: 0; }
  .is-split .triage-table td:first-child { grid-column: 1 / -1; }
  .is-split .triage-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 0.15rem; }
  .is-split .triage-table tr.is-selected { border-left-color: var(--accent); border-radius: 4px; }

  .triage-table tr.is-selected { background: var(--surface); }
  .triage-table tr.is-selected td:first-child a { color: var(--text-primary); font-weight: 700; }

  .report-viewer { position: sticky; top: calc(var(--bug-anchor-offset, 9rem) - 0.5rem); max-height: calc(100vh - var(--bug-anchor-offset, 9rem)); overflow-y: auto; border-radius: 8px; }
  .report-viewer[hidden] { display: none; }
  .bug-guide-cards[hidden] { display: none; }
  .report-viewer .report-viewer-card { box-shadow: none; }
  .report-viewer-close { display: none; margin-top: 0.75rem; padding: 0.4rem 0; border: 0; background: none; font: inherit; font-size: 0.85rem; color: var(--accent-link, var(--accent)); cursor: pointer; }

  /* Single column: the report sits in its own table row under the selected bug. */
  .triage-table tr.report-viewer-row { display: table-row; background: none; }
  .triage-table tr.report-viewer-row > td { padding: 0 0 1rem; border-bottom: 1px solid var(--border-light); }
  /* Inside the directory, undo its list and link styles. */
  .report-viewer li { display: list-item; gap: normal; }
  .report-viewer :is(p, li) a { text-decoration: underline; text-underline-offset: 0.15em; }

  @media (max-width: 900px) {
    .report-viewer { position: static; max-height: none; overflow: visible; }
    .report-viewer-close { display: inline-block; }
  }

  @media (max-width: 600px) {
    .triage-table tr.report-viewer-row { display: block; padding: 0 0 1rem; }
    .triage-table tr.report-viewer-row > td { display: block; padding: 0; border: 0; }
  }
}

/* Sidebar mirrors the active report filters. */
html[data-page="bugs"] .toc-link[hidden] { display: none; }
html[data-page="bugs"] .sidebar-filter-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem 0.8rem; font-size: 0.78rem; color: var(--text-secondary); }
html[data-page="bugs"] :is(#sidebar-clear-filters, #clear-filters-btn) { font: inherit; color: var(--accent-link, var(--accent)); background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.3rem 0.5rem; cursor: pointer; }
html[data-page="bugs"] :is(#sidebar-clear-filters, #clear-filters-btn):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-page="bugs"] .sidebar-empty { padding: 0.5rem 0.6rem; color: var(--text-secondary); font-size: 0.82rem; }

html[data-page="bugs"] .filter-reveal-notice {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 1.25rem;
  transform: translateY(-50%);
  max-width: calc(100% - 2.5rem);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--bug-guide-color, var(--accent));
  border-radius: 4px;
  background: var(--bug-guide-color, var(--accent));
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

html[data-page="bugs"] .filter-match-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

html[data-page="bugs"] .filter-match-divider::after {
  flex: 1;
  height: 1px;
  background: var(--border-light);
  content: "";
}

html[data-page="bugs"] :is(#sidebar-clear-filters, #clear-filters-btn):hover { background: var(--accent-glow); text-decoration: none; }

/* Expand/collapse sections, added by app.js on the Recap page. */
@scope (html[data-page="recap"]) {
  .collapse-controls { display: flex; justify-content: flex-end; }

  .collapse-all { font-family: var(--font-display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.4rem 0.9rem; border: 1px solid var(--accent); border-radius: 999px; background: transparent; color: var(--accent); cursor: pointer; }

  .collapse-all:hover { background: var(--accent-fill); color: var(--card-bg); }

  .collapse-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }

  .collapse-toggle::after { content: ''; flex: none; width: 0.55rem; height: 0.55rem; margin: 0.3rem 0.25rem 0 0; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-135deg); transition: transform 0.15s ease; }

  .collapsed .collapse-toggle::after { margin-top: -0.3rem; transform: rotate(45deg); }

  .collapse-toggle:hover { color: var(--accent); }

  .collapse-toggle:focus-visible, .collapse-all:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
}

@scope (html[data-page="recap"]) {
  .collapse-controls { margin-top: 1.5rem; margin-bottom: -1.5rem; }

  section.collapsed { padding-block: 1.75rem; }
}

/* Solutions list + solution viewer (enabled by app.js). */
@scope (html[data-page="solutions"]) {
  .solution-layout { margin: 2rem 0 3rem; }
  .solution-layout .toc { margin: 0; }

  /* Two columns while a solution is open; the full-width list otherwise. */
  .solution-layout.is-split { display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .is-split .toc ol { padding-left: 1.25rem; }

  /* Every item reserves room for the selection bar, so text never shifts or sits under it. */
  .solution-layout .toc ol > li { padding-inline: 0.6rem 0.5rem; border-left: 3px solid transparent; border-radius: 0 4px 4px 0; }
  .solution-layout .toc ol > li.is-selected { background: var(--surface); border-left-color: var(--accent); }
  .toc li.is-selected > a { color: var(--text-primary); font-weight: 700; }

  /* The short list stays pinned beside the solution; the solution itself
     scrolls with the page (no scroll box inside the page). */
  .solution-layout.is-split .toc { position: sticky; top: calc(var(--site-header-height, 4rem) + 1rem); max-height: calc(100vh - var(--site-header-height, 4rem) - 2rem); overflow-y: auto; }
  .report-viewer { border-radius: 8px; }
  .report-viewer[hidden] { display: none; }
  .report-viewer .solution { margin: 0; box-shadow: none; }
  .report-viewer-close { display: none; margin-top: 0.75rem; padding: 0.4rem 0; border: 0; background: none; font: inherit; font-size: 0.85rem; color: var(--accent-link, var(--accent)); cursor: pointer; }

  /* Single column: the solution opens in an unnumbered row under its title,
     lined up with the title's highlight. */
  .solution-layout .toc ol > li.report-viewer-row { display: block; margin: 0.25rem 0 0.75rem; padding: 0; border-left: 0; }
  /* Inside the list, undo the list's item and link styles. */
  .report-viewer li { font-size: 0.95rem; padding: 0.15rem 0; }
  .report-viewer .solution h2 { font-size: 1.35rem; letter-spacing: normal; text-transform: none; color: var(--text-primary); margin-bottom: 0.35rem; }
  .report-viewer :is(p, li) a { text-decoration: underline; text-underline-offset: 0.15em; }

  @media (max-width: 900px) {
    .report-viewer-close { display: inline-block; }
    /* Match the Bug Directory's single-column look: highlight only, no bar. */
    .solution-layout .toc ol > li.is-selected { border-left-color: transparent; }
  }
}

/* "Click a title" tip above the Bug Directory list (added by app.js). */
@scope (html[data-page="bugs"]) {
  .has-viewer-tip { position: relative; }
  /* Floats over the column header, just above the first bug title. */
  .viewer-tip { position: absolute; z-index: 5; left: var(--tip-offset, 3rem); bottom: calc(100% - 0.35rem); display: flex; align-items: center; gap: 0.5rem; width: max-content; max-width: min(22rem, 90vw); margin: 0; padding: 0.5rem 0.5rem 0.5rem 0.85rem; background: var(--accent-fill); color: #ffffff; border-radius: 8px; font-size: 0.85rem; line-height: 1.4; box-shadow: 0 2px 8px var(--card-shadow); }
  /* Speech-bubble pointer toward the titles below. */
  .viewer-tip::after { content: ''; position: absolute; left: 1.25rem; bottom: -0.4rem; width: 0.8rem; height: 0.8rem; background: inherit; transform: rotate(45deg); }
  .viewer-tip-close { flex: none; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; }
  .viewer-tip-close:hover { background: rgba(255, 255, 255, 0.18); }
  .viewer-tip-close:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }

  /* Stacked rows have no header row to float over, so sit in the flow. */
  @media (max-width: 600px) {
    .viewer-tip { position: relative; left: auto; bottom: auto; margin: 0 0 0.75rem; }
  }
  .is-split .viewer-tip { position: relative; left: auto; bottom: auto; margin: 0 0 0.75rem; }
}

/* Site header. At the top of the page: the main bar with the BugBlitz brand
   and page tabs, each opening a menu of that page's sections on hover or
   keyboard focus. Once the main bar scrolls away, a secondary bar with the
   page name and its "On this page" links slides in, pinned to the top
   (html.is-scrolled, set by app.js). */
@scope (html[data-page]) {
  .site-header { position: relative; z-index: 150; background: var(--nav-bg, var(--ground)); border-bottom: 1px solid var(--border-light); }
  .site-bar { display: flex; align-items: center; gap: 1rem; max-width: 64rem; margin: 0 auto; padding: 0.5rem 1rem; }
  .site-brand { margin-right: auto; font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
  .site-brand:hover { color: var(--accent); }
  .site-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

  .page-nav-list { display: flex; align-items: center; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
  .page-nav-item { position: relative; display: flex; align-items: center; border-radius: 6px; }
  .page-nav-item > a { display: inline-flex; align-items: center; min-height: 40px; padding: 0.45rem 0.9rem; border-radius: 6px; font-family: var(--font-display); font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-secondary); text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease; }
  .page-nav-item > a[aria-current="page"] { background: var(--accent-fill); color: #ffffff; }
  .page-nav-item:not(:has(> a[aria-current])):hover, .page-nav-item.has-menu:focus-within { background: var(--surface); }
  .page-nav-item:hover > a:not([aria-current]), .page-nav-item.has-menu:focus-within > a { color: var(--text-primary); }

  .page-nav-menu { display: none; position: absolute; z-index: 10; top: 100%; left: 0; min-width: 14rem; margin: 0; padding: 0.35rem; list-style: none; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px var(--card-shadow); }
  /* Bridges the gap so the menu stays open while the pointer moves onto it. */
  .page-nav-menu::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
  /* The last tab's menu opens leftward so it stays on screen. */
  .page-nav-item:last-child > .page-nav-menu { left: auto; right: 0; }
  .page-nav-item.has-menu:focus-within > .page-nav-menu { display: block; top: calc(100% + 6px); }
  @media (hover: hover) {
    .page-nav-item.has-menu:hover > .page-nav-menu { display: block; top: calc(100% + 6px); }
  }
  .page-nav-menu a { display: block; padding: 0.45rem 0.7rem; border-radius: 5px; font-size: 0.92rem; line-height: 1.35; color: var(--text-primary); text-decoration: none; white-space: nowrap; }
  .page-nav-menu a:hover { background: var(--surface); color: var(--accent); }
  .page-nav :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* Secondary bar: page name, then the section chips; the section being read
     is highlighted (app.js). Hidden above the viewport until scrolled. */
  .site-header .section-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 160; border-bottom: 1px solid var(--border); background: var(--surface); box-shadow: 0 2px 10px var(--card-shadow); backdrop-filter: none; -webkit-backdrop-filter: none; scrollbar-width: none; transform: translateY(-8px); opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s; }
  :scope.is-scrolled .site-header .section-nav { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s; }
  @media (prefers-reduced-motion: reduce) {
    .site-header .section-nav, :scope.is-scrolled .site-header .section-nav { transition: none; }
  }
  .site-header .section-nav::-webkit-scrollbar { display: none; }
  .site-header .section-nav-inner { align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; }
  .site-header .section-nav-page { order: 0; flex: none; padding-right: 0.85rem; margin-right: 0.35rem; border-right: 1px solid var(--border); font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
  .site-header .section-nav-inner:not(:has(a)) .section-nav-page { border-right: 0; }
  .site-header .section-nav-inner::before { content: 'On this page'; order: 1; flex: none; margin-right: 0.75rem; font-family: var(--font-display); font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
  .site-header .section-nav-inner:not(:has(a))::before { display: none; }
  .site-header .section-nav a { order: 2; flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 0.75rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; text-transform: none; color: var(--text-secondary); }
  .site-header .section-nav a:hover { color: var(--accent); background: transparent; }
  .site-header .section-nav a:not([aria-current="location"]):not(.section-nav-top):hover {
    border-bottom-color: color-mix(in srgb, var(--accent) 40%, transparent);
  }
  .site-header .section-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .site-header .section-nav a[aria-current="location"] { background: transparent; border-bottom-color: var(--accent); color: var(--accent); font-weight: 700; }
  .site-header .section-nav a.section-nav-top { order: 3; margin-left: auto; color: var(--text-secondary); white-space: nowrap; }

  /* Phones: the section links collapse into a dropdown (set up by app.js). */
  .section-nav-toggle { display: none; }
  @media (max-width: 700px) {
    .site-header .section-nav.has-dropdown { overflow: visible; }
    .site-header .section-nav.has-dropdown > .section-nav-top { position: absolute; top: 0; right: 0.75rem; min-height: 44px; padding: 0.5rem; }
    .site-header .section-nav.has-dropdown .section-nav-toggle { padding-right: 5rem; }
    .site-header .section-nav.has-dropdown .section-nav-page { display: none; }
    .section-nav-toggle { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.55rem 1rem; border: 0; background: none; font: inherit; color: var(--text-primary); text-align: left; cursor: pointer; }
    .section-nav-toggle-label { flex: none; font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); }
    .section-nav-toggle-current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; color: var(--accent); }
    .section-nav-toggle::after { content: ''; flex: none; width: 0.45rem; height: 0.45rem; margin: -0.2rem 0.25rem 0 0; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg); transition: transform 0.15s ease; }
    .section-nav.is-open .section-nav-toggle::after { margin-top: 0.25rem; transform: rotate(-135deg); }
    .section-nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

    .site-header .section-nav.has-dropdown .section-nav-inner { display: none; position: absolute; z-index: 5; top: 100%; left: 0.5rem; right: 0.5rem; flex-direction: column; align-items: stretch; gap: 0.15rem; max-height: 60vh; overflow-y: auto; margin: 0; padding: 0.4rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px var(--card-shadow); }
    .site-header .section-nav.has-dropdown.is-open .section-nav-inner { display: flex; }
    .site-header .section-nav.has-dropdown .section-nav-inner::before { display: none; }
    .site-header .section-nav.has-dropdown a { padding: 0.65rem 0.75rem; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 0.95rem; color: var(--text-primary); }
    .site-header .section-nav.has-dropdown a:hover { background: var(--surface); }
    .site-header .section-nav.has-dropdown a[aria-current="location"] { background: var(--surface); color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
  }

  @media (max-width: 700px) {
    .site-bar { padding: 0.4rem 0.5rem; }
    /* Room for all four tabs; the brand already links to the Workshop Guide tab. */
    .site-brand { display: none; }
    .page-nav { flex: 1; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .page-nav-list { width: max-content; margin: 0 auto; }
    .page-nav-item > a { min-height: 36px; padding: 0.4rem 0.7rem; font-size: 0.85rem; }
    .page-nav-menu { display: none !important; }
  }
}

/* Anchors and sticky panels clear the pinned header. */
html[data-page]:not([data-page="bugs"]) [id] { scroll-margin-top: calc(var(--site-header-height, 7rem) + 1rem); }
html[data-page="solutions"] .solution-layout li { scroll-margin-top: calc(var(--site-header-height, 4rem) + 1rem); }

/* Close (×) button in the corner of an open bug report or solution (app.js).
   The X is drawn with two lines so it sits exactly centered at any size. */
@scope (html:is([data-page="bugs"], [data-page="solutions"])) {
  .report-viewer-dismiss { position: absolute; z-index: 2; top: 0.85rem; right: 0.85rem; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; }
  .report-viewer-dismiss::before, .report-viewer-dismiss::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0.95rem; height: 2px; border-radius: 1px; background: currentColor; }
  .report-viewer-dismiss::before { transform: translate(-50%, -50%) rotate(45deg); }
  .report-viewer-dismiss::after { transform: translate(-50%, -50%) rotate(-45deg); }
  .report-viewer-dismiss:hover { background: var(--surface); color: var(--accent); }
  .report-viewer-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  /* Keep the first row of the card (type tags) clear of the ×. */
  .report-viewer .bug-guide-card-header { padding-right: 2.25rem; }
}

/* The × is positioned against the viewer: the Bug Report's wide viewer is
   already sticky; otherwise make it relative (dropping the pinned offset). */
@scope (html[data-page="solutions"]) {
  .report-viewer { position: relative; }
}
@media (max-width: 900px) {
  html[data-page="bugs"] .report-viewer { position: relative; top: auto; }
}

/* Bug report pop-up, opened from cards on the triage board (app.js). */
html[data-page="bugs"] { scrollbar-gutter: stable; }
html[data-page="bugs"].report-dialog-open,
html[data-page="bugs"].report-dialog-open body { overflow: hidden; }
@scope (html[data-page="bugs"]) {
  .report-directory-header {
    position: relative;
    z-index: 3;
    margin: -1.75rem -1.75rem 1rem;
    padding: 1rem 3.75rem 1rem 1.75rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
  }
  .report-directory-header h3 { margin: 0; overflow-wrap: anywhere; }
  .report-viewer:has(.report-directory-header) .bug-guide-card-header { padding-right: 0; }
  @media (min-width: 901px) {
    .report-directory-header { position: sticky; top: 0; }
  }
  .report-dialog { width: min(46rem, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); margin: auto; padding: 0; border: 0; border-radius: 10px; background: transparent; overflow: visible; }
  .report-dialog::backdrop { background: rgba(27, 10, 46, 0.5); }
  .report-dialog-body { max-height: calc(100vh - 3rem); overflow-y: auto; overscroll-behavior: contain; border-radius: 10px; }
  .report-dialog .bug-guide-card { margin: 0; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3); }
  .report-dialog-header {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: -1.75rem -1.75rem 1rem;
    padding: 1rem 3.75rem 0.85rem 1.75rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-light);
    border-radius: 8px 8px 0 0;
  }
  .report-dialog-header h3 { margin: 0 0 0.5rem; overflow-wrap: anywhere; }
  .report-dialog .bug-guide-card-header { padding-right: 0; margin-bottom: 0; }
  .report-dialog-header .starter-bug-badge { margin: 0; }
  .report-dialog-header .report-viewer-dismiss { top: 0.85rem; right: 0.85rem; }
  .report-dialog .bug-guide-card-footer { align-items: center; gap: 1rem; }
  .report-dialog-open-list { margin-right: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 0.9rem; font-weight: 700; color: var(--accent-link, var(--accent)); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
  .report-dialog-open-list:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  @media (max-width: 600px) {
    .report-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
    .report-dialog-body { max-height: calc(100vh - 1rem); }
  }
}

/* Dark-mode guidance shares one surface; borders carry its accent. */
@scope (html[data-page]) {
  :scope[data-theme="dark"] .effort-matrix td.quick-win {
    background: var(--accent-fill);
    color: #ffffff;
  }
  :scope[data-theme="dark"] :is(.setup-callout, .notice, .hints-intro, .exercise-tip, .bug-hints, .bug-guide-card .workshop-prompt, .viewer-tip) {
    background: var(--surface);
  }
  :scope[data-theme="dark"] .viewer-tip {
    border: 1px solid var(--accent-fill-border);
    border-left: 3px solid var(--accent);
  }
  @media (prefers-color-scheme: dark) {
    :scope:not([data-theme="light"]) .effort-matrix td.quick-win {
      background: var(--accent-fill);
      color: #ffffff;
    }
    :scope:not([data-theme="light"]) :is(.setup-callout, .notice, .hints-intro, .exercise-tip, .bug-hints, .bug-guide-card .workshop-prompt, .viewer-tip) {
      background: var(--surface);
    }
    :scope:not([data-theme="light"]) .viewer-tip {
      border: 1px solid var(--accent-fill-border);
      border-left: 3px solid var(--accent);
    }
  }
}
