.representation-proof-main {
  width: min(100%, 90rem);
  margin-inline: auto;
  padding: clamp(2rem, 5vw, 4rem) var(--page-gutter);
}

.representation-proof-intro {
  max-width: var(--reading-width);
  margin-block-end: var(--space-xl);
}

.representation-proof-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl);
}

.representation-proof-case {
  min-inline-size: 0;
}

.representation-proof-case > h2 {
  margin-block: 0 var(--space-sm);
  color: var(--color-text-primary);
  font-size: 1rem;
}

.musical-representation {
  --representation-primary: var(--color-text-primary);
  --representation-muted: var(--color-text-secondary);
  --representation-staff: var(--color-border-strong);
  --representation-root: var(--color-theory-root-note);
  --representation-root-outline: var(--color-theory-root-outline);
  --representation-scale: var(--color-theory-scale-tone);
  --representation-scale-outline: var(--color-theory-scale-outline);
  --representation-scale-label: var(--color-theory-scale-label);
  --representation-chord: var(--color-theory-chord-tone);
  --representation-chord-outline: var(--color-theory-chord-outline);
  --representation-selected: var(--color-theory-selected-note);
  --representation-emphasized: var(--color-theory-interval-highlight);
  --representation-focus: var(--color-focus-ring);
  --representation-surface: var(--color-surface);
  --representation-background: var(--color-card-background);

  min-inline-size: 0;
  margin: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--representation-background);
  color: var(--representation-primary);
  box-shadow: var(--shadow-raised);
  font-size: var(--representation-root-font-size, 16px);
  break-inside: avoid;
}

.musical-representation[data-theme-variant="light"] {
  --representation-primary: #111111;
  --representation-muted: #414141;
  --representation-staff: #4a4a4a;
  --representation-scale: #ffffff;
  --representation-scale-outline: #111111;
  --representation-scale-label: #111111;
  --representation-chord-outline: #111111;
  --representation-surface: #ffffff;
  --representation-background: #f4f4f4;
  color-scheme: light;
}

.musical-representation[data-high-contrast="true"] {
  --representation-staff: var(--representation-primary);
  border-width: 2px;
}

.representation-caption {
  display: grid;
  gap: 0.25em;
  margin-block-end: 1em;
  line-height: 1.35;
}

.representation-caption strong {
  color: var(--representation-primary);
  font-size: 1.05em;
}

.representation-caption span {
  color: var(--representation-muted);
  font-size: 0.875em;
}

.representation-blocks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-inline-size: 0;
  gap: 1.5em;
}

.representation-staff-region {
  min-inline-size: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.25rem 0.125rem 0.75rem;
  border-radius: var(--radius-sm);
  scrollbar-color: var(--representation-muted) transparent;
}

.representation-staff-region:focus-visible {
  outline: 3px solid var(--representation-focus);
  outline-offset: 3px;
}

.representation-staff-canvas {
  width: max-content;
  min-width: 100%;
}

.representation-staff-svg {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  color: var(--representation-primary);
}

.representation-staff-line,
.representation-ledger-line {
  stroke: var(--representation-staff);
  vector-effect: non-scaling-stroke;
}

.representation-root-diamond {
  fill: var(--representation-root);
  stroke: var(--representation-root-outline);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.representation-selected-outline,
.representation-emphasized-outline {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.representation-selected-outline {
  stroke: var(--representation-selected);
}

.representation-emphasized-outline {
  stroke: var(--representation-emphasized);
  stroke-dasharray: 4 3;
}

.representation-role-primary {
  fill: var(--representation-primary);
  color: var(--representation-primary);
}

.representation-role-root {
  fill: var(--representation-root);
  color: var(--representation-root);
}

.representation-role-scale {
  fill: var(--representation-scale);
  stroke: var(--representation-scale-outline);
  stroke-width: 0.75;
  color: var(--representation-scale-label);
  paint-order: stroke fill;
}

.representation-role-chord {
  fill: var(--representation-chord);
  stroke: var(--representation-chord-outline);
  stroke-width: 0.75;
  color: var(--representation-chord);
  paint-order: stroke fill;
}

.representation-staff-label {
  font-family: var(--font-family-sans);
  font-size: 0.875em;
  font-weight: 650;
  stroke: none;
}

.representation-staff-label.representation-role-scale {
  fill: var(--representation-scale-label);
}

.representation-tone-strip {
  display: flex;
  flex-wrap: wrap;
  min-inline-size: 0;
  gap: 0.5em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.representation-tone-group {
  display: inline-flex;
  flex: 0 0 auto;
  max-inline-size: 100%;
  box-sizing: border-box;
  align-items: center;
  gap: 0.5em;
  min-height: 2.75em;
  padding: 0.5em 0.75em;
  border: 2px solid var(--representation-muted);
  border-radius: var(--radius-md);
  background: var(--representation-surface);
  color: var(--representation-primary);
  font-weight: 650;
  break-inside: avoid;
  white-space: nowrap;
}

.representation-tone-root {
  border-inline-start: 0.35em solid var(--representation-root);
}

.representation-tone-scale {
  box-shadow: inset 0 0 0 1px var(--representation-scale-outline);
}

.representation-tone-chord {
  border-color: var(--representation-chord);
}

.representation-tone-selected {
  outline: 2px solid var(--representation-selected);
  outline-offset: 2px;
}

.representation-tone-emphasized {
  font-weight: 800;
  text-decoration: underline double var(--representation-emphasized);
  text-underline-offset: 0.2em;
}

.representation-tone-cues {
  display: inline-flex;
  gap: 0.3em;
  color: var(--representation-muted);
  font-size: 0.68em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.representation-tone-cues span + span::before {
  content: "·";
  margin-inline-end: 0.3em;
}

.representation-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 30rem) {
  .representation-tone-group {
    flex-wrap: wrap;
    white-space: normal;
  }

  .representation-tone-label,
  .representation-tone-cues {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  .representation-tone-cues {
    flex-wrap: wrap;
    max-inline-size: 100%;
    white-space: normal;
  }

  .representation-tone-cues span {
    white-space: nowrap;
  }
}

@media (prefers-contrast: more) {
  .musical-representation {
    --representation-staff: var(--representation-primary);
    border-width: 2px;
  }

  .representation-tone-group {
    border-width: 3px;
  }
}

@media (forced-colors: active) {
  .musical-representation {
    --representation-primary: CanvasText;
    --representation-muted: CanvasText;
    --representation-staff: CanvasText;
    --representation-root: Highlight;
    --representation-root-outline: CanvasText;
    --representation-scale: Canvas;
    --representation-scale-outline: CanvasText;
    --representation-scale-label: CanvasText;
    --representation-chord: Mark;
    --representation-chord-outline: CanvasText;
    --representation-selected: Highlight;
    --representation-emphasized: LinkText;
    --representation-focus: Highlight;
    --representation-surface: Canvas;
    --representation-background: Canvas;
    forced-color-adjust: none;
  }

  .representation-tone-root {
    border-inline-start-width: 0.5em;
  }

  .representation-selected-outline,
  .representation-tone-selected {
    stroke-width: 3;
    outline-width: 3px;
  }

  .representation-emphasized-outline {
    stroke-dasharray: 6 3;
  }
}

@media print {
  .musical-representation,
  .representation-tone-group {
    break-inside: avoid;
  }
}

/* Reference owns article spacing and intrinsic notation; the proof keeps its layout. */
.reference-representation {
  min-inline-size: 0;
  max-inline-size: 100%;
  margin-block-start: 2rem;
}

.reference-representation .representation-staff-canvas {
  min-width: 0;
  margin-inline: auto;
}

.reference-representation .representation-tone-strip {
  justify-content: center;
}

@media print {
  /* Reference notation retains its own monochrome roles and opaque interiors. */
  .reference-representation .musical-representation {
    --representation-primary: #111111;
    --representation-muted: #333333;
    --representation-staff: #555555;
    --representation-root: #111111;
    --representation-root-outline: #111111;
    --representation-scale: #ffffff;
    --representation-scale-outline: #111111;
    --representation-scale-label: #111111;
    --representation-chord: #111111;
    --representation-chord-outline: #111111;
    --representation-selected: #111111;
    --representation-emphasized: #111111;
    --representation-surface: #ffffff;
    --representation-background: #ffffff;
    border-color: #777777;
    box-shadow: none;
    break-inside: avoid;
  }

  /* Opaque paper fill covers support lines beneath the outlined root marker. */
  .reference-representation .representation-root-diamond {
    fill: #ffffff;
  }

  .reference-representation .representation-staff-region {
    overflow: visible;
  }

  .reference-representation .representation-tone-group {
    box-shadow: none;
  }

  .reference-representation .representation-visually-hidden {
    display: none !important;
  }
}


/* Phase 6 reusable notation: ordinary foreground ink, independent of Reference. */
.musical-representation {
  --representation-primary: var(--color-text-primary, #f5f5f5);
  --representation-surface: var(--color-surface, #171717);
  --representation-focus: var(--color-focus-ring, #6daaff);
}
.musical-representation[data-theme-variant="light"] {
  --representation-primary: #111;
  --representation-surface: #fff;
}
.musical-representation .representation-staff-svg .representation-notehead,
.musical-representation .representation-staff-svg .representation-accidental,
.musical-representation .representation-staff-svg .representation-clef,
.musical-representation .representation-staff-label {
  fill: var(--representation-primary);
}
.musical-representation .representation-staff-line,
.musical-representation .representation-ledger-line,
.musical-representation .representation-string-line,
.musical-representation .representation-fret-line,
.musical-representation .representation-nut-line {
  stroke: var(--representation-primary);
  vector-effect: non-scaling-stroke;
}
.musical-representation .representation-grid-stop { fill: var(--representation-primary); }
.musical-representation .representation-grid-open {
  fill: var(--representation-surface);
  stroke: var(--representation-primary);
  stroke-width: 2;
}
.musical-representation .representation-grid-mute {
  fill: none;
  stroke: var(--representation-primary);
  stroke-width: 2;
}
.musical-representation .representation-grid-interior { fill: var(--representation-surface); }
.musical-representation .representation-grid-text {
  fill: var(--representation-primary);
  font-family: var(--font-family-ui, system-ui, sans-serif);
  font-size: 0.875em;
  font-weight: 600;
  unicode-bidi: isolate;
}
.musical-representation .representation-gridFinger { fill: var(--representation-surface); }
.notation-template { padding: 0; border: 0; box-shadow: none; background: transparent; }
@media print {
  .musical-representation,
  .musical-representation[data-theme-variant],
  .musical-representation[data-high-contrast] {
    --representation-primary: #000;
    --representation-muted: #000;
    --representation-staff: #000;
    --representation-surface: #fff;
    --representation-background: #fff;
    --representation-selected: #000;
    --representation-emphasized: #000;
    color: #000;
    background: transparent;
    border: 0;
    box-shadow: none;
    break-inside: avoid;
  }
  .musical-representation .representation-staff-region { overflow: visible; padding: 0; }
  .musical-representation .representation-staff-canvas { min-width: 0; }
  .musical-representation .representation-semantic-detail { display: none; }
}

.musical-representation .representation-staff-svg .representation-role-primary {
  stroke: var(--representation-primary);
  stroke-width: 0.75;
  paint-order: stroke fill;
}
.musical-representation .representation-staff-svg .representation-selected-outline,
.musical-representation .representation-staff-svg .representation-emphasized-outline {
  stroke: var(--representation-primary);
}
@media (forced-colors: active) {
  .musical-representation,
  .musical-representation[data-theme-variant] {
    --representation-primary: CanvasText;
    --representation-surface: Canvas;
    --representation-focus: Highlight;
  }
}
