/* Eigenständige Gestaltung: große relative Schrift und Kontraste ohne Dev-Layout. */
:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 137.5%;
  line-height: 1.6;
  color: #17212b;
  background: #edf1f5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
/* Für Screenreader zugänglich, ohne zusätzlichen sichtbaren Meldungsbereich. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
main { width: min(44rem, calc(100% - 1.5rem)); margin: 1.5rem auto 2rem; }
h1 { font-size: 1.65rem; line-height: 1.25; margin: 0 0 1.25rem; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; line-height: 1.35; margin: 0 0 1rem; }
p { margin: .75rem 0; }

/* Einspaltige Bereiche und umbrechende Inhalte erhalten die Bedienung bei Vergrößerung. */
.panel { padding: 1.25rem; margin-bottom: 1rem; background: #fff; border: 2px solid #52616f; border-radius: .5rem; overflow-wrap: anywhere; }
.field { margin-bottom: 1.1rem; }
label, legend { font-weight: 650; }
.field > label { display: block; margin-bottom: .35rem; }
input, select, button { font: inherit; }
input[type="file"], input[type="url"], select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 2.5rem;
  padding: .4rem;
  border: 2px solid #52616f;
  border-radius: .25rem;
  color: #17212b;
  background: #fff;
}
input::file-selector-button {
  font: inherit;
  padding: .4rem .6rem;
  margin: 0 .5rem .2rem 0;
  border: 2px solid #52616f;
  border-radius: .2rem;
  color: #17212b;
  background: #edf1f5;
  cursor: pointer;
}
fieldset { min-width: 0; padding: .65rem; margin: 0 0 1.1rem; border: 2px solid #52616f; border-radius: .25rem; }
legend { padding-inline: .25rem; }
.option { display: flex; align-items: center; gap: .65rem; min-height: 2.5rem; padding: .3rem; cursor: pointer; }
.option input { width: 1.05rem; height: 1.05rem; margin: 0; flex-shrink: 0; accent-color: #173f6b; }
.option label { flex: 1; cursor: pointer; }
button {
  width: 100%;
  min-height: 2.75rem;
  padding: .6rem .8rem;
  border: 2px solid #173f6b;
  border-radius: .3rem;
  font-weight: 700;
  color: #fff;
  background: #173f6b;
  cursor: pointer;
}
button:hover { background: #102e4e; }
/* aria-disabled erhält den Fokus auf dem Startknopf; das Skript verhindert doppelte Aufträge. */
button[aria-disabled="true"] { cursor: default; }
input:disabled, select:disabled, fieldset:disabled { opacity: 1; color: #17212b; }
.secondary-button { width: auto; color: #173f6b; background: #fff; }
.secondary-button:hover { background: #edf1f5; }
/* Ein fokussierter Statusknopf bleibt nach Erfolg sichtbar und als gesperrt erkennbar. */
.secondary-button[aria-disabled="true"] { color: #17212b; background: #edf1f5; border-color: #52616f; }
a { color: #173f6b; text-decoration-thickness: .1em; text-underline-offset: .15em; }
.result-link { display: block; margin-top: .75rem; }
#user-status { font-weight: 650; }
#user-error, #user-copy-error, #speech-error { color: #8b1520; font-weight: 700; overflow-wrap: anywhere; }
#user-error:empty, #user-copy-status:empty, #user-copy-error:empty,
#speech-status:empty, #speech-error:empty { margin: 0; }
/* Die Steuerung bleibt ohne horizontales Scrollen sichtbar, auch bei großer Schrift. */
.speech-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: 1rem; }
.speech-buttons button[aria-disabled="true"] { color: #17212b; background: #edf1f5; border-color: #52616f; cursor: default; }
#user-summary { overflow-wrap: anywhere; }
#user-summary p { white-space: pre-wrap; }
.summary-sources { border-left: 3px solid #52616f; padding-left: .65rem; }
.speech-rate-field { margin-top: 1rem; }
#speech-rate { display: block; width: 100%; min-width: 0; min-height: 2.5rem; margin-inline: 0; appearance: none; background: transparent; }
/* Die native Reglersemantik bleibt erhalten; Schiene und Griff erhalten die
   bereits kontrastgeprüften Farben statt der schwachen Standard-Schienenkante. */
#speech-rate::-webkit-slider-runnable-track { height: .6rem; border: 2px solid #52616f; border-radius: .3rem; background: #edf1f5; }
#speech-rate::-webkit-slider-thumb { appearance: none; width: 1rem; height: 1rem; margin-top: calc(-.2rem - 2px); border: 2px solid #173f6b; border-radius: 50%; background: #173f6b; }
#speech-rate::-moz-range-track { height: .6rem; box-sizing: border-box; border: 2px solid #52616f; border-radius: .3rem; background: #edf1f5; }
#speech-rate::-moz-range-thumb { width: 1rem; height: 1rem; box-sizing: border-box; border: 2px solid #173f6b; border-radius: 50%; background: #173f6b; }
#user-download-error { color: #8b1520; font-weight: 700; }
#user-download-status:empty, #user-download-error:empty { margin: 0; }

/* Der Tastaturfokus hat einen dunklen Rand und ausreichend Abstand zum Element. */
:focus-visible { outline: 3px solid #111; outline-offset: 4px; }
.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 1; padding: .5rem; background: #fff; transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }
.keyframe-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); gap: 1rem; }
.keyframe-gallery figure { min-width: 0; margin: 0; }
.keyframe-gallery .keyframe-open { display: block; padding: 0; min-height: 0; border: 2px solid #52616f; border-radius: .25rem; background: #edf1f5; }
.keyframe-gallery img { display: block; width: 100%; height: 11rem; object-fit: contain; background: #edf1f5; }
.keyframe-gallery figcaption { margin-top: .3rem; font-variant-numeric: tabular-nums; }
@media (max-width: 30rem) {
  /* Außenabstände wachsen bei starker Schriftvergrößerung nicht mit dem Text mit. */
  main { width: calc(100% - 24px); }
  .panel { padding: 12px; }
  fieldset { padding: 10px; }
  .option { padding: 6px; gap: 10px; }
  button { padding-inline: 12px; }
  .speech-buttons { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
  input::file-selector-button { display: block; margin-bottom: .4rem; max-width: 100%; white-space: normal; }
}
/* Individuelle Kontrastfarben bleiben nutzbar; der Browser kann eigene Farben einsetzen. */
@media (forced-colors: active) {
  button { border-color: ButtonText; }
  :focus-visible { outline-color: Highlight; }
  #speech-rate::-webkit-slider-runnable-track { background: Canvas; border-color: CanvasText; }
  #speech-rate::-webkit-slider-thumb { background: Highlight; border-color: Highlight; }
  #speech-rate::-moz-range-track { background: Canvas; border-color: CanvasText; }
  #speech-rate::-moz-range-thumb { background: Highlight; border-color: Highlight; }
}
