:root {
  color-scheme: light;
  --paper: #f4f5f3;
  --surface: #fff;
  --surface-alt: #f6f7f8;
  --ink: #19212b;
  --muted: #4c5967;
  --border: #ccd3da;
  --field-border: #7d8995;
  --accent: #214bc7;
  --accent-dark: #17399f;
  --accent-pale: #edf2ff;
  --ok: #1d6b3a;
  --warn: #8a4b00;
  --error: #a3241b;
  --track: #dde2ea;
  --disabled: #e9edf2;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
p, h1, h2, h3, figure, pre { margin: 0; }
p, li, dd { text-wrap: pretty; }
.help, .ai-note, .tool-header p, .site-footer p, .network-status { max-width: 70ch; }

a { color: var(--accent); text-underline-offset: .22em; }

:where(a, button, select, textarea, summary, audio, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.shell {
  width: min(100% - 3rem, 70rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: .75rem;
  left: .75rem;
  z-index: 2;
  padding: .7rem 1rem;
  background: var(--surface);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--border); }
.header-inner, .site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}
.header-inner { min-height: 4.375rem; }
.site-header nav { gap: .25rem 1.65rem; }
.site-header a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
}
.site-header a:hover { color: var(--accent); text-decoration: underline; }

.wordmark { gap: .7rem; }
.mark {
  width: 1.25rem;
  aspect-ratio: 1;
  border: 2px solid var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--paper);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr);
  align-items: end;
  gap: 3rem clamp(3rem, 9vw, 8rem);
  padding-block: clamp(3.25rem, 7vw, 6rem) clamp(2.75rem, 5vw, 4.5rem);
}
h1 {
  font-size: clamp(3.35rem, 8.9vw, 7.75rem);
  font-weight: 680;
  letter-spacing: -.073em;
  line-height: .92;
}
.intro {
  max-width: 32rem;
  margin-top: 1.65rem;
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  color: var(--muted);
}
.hero-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: .7rem;
  font-weight: 650;
}

.flow {
  align-self: center;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  padding: 1.05rem 0 1.3rem;
}
.flow figcaption {
  margin-bottom: .95rem;
  color: var(--accent-dark);
  font-family: var(--mono);
  font-size: .875rem;
  font-weight: 650;
}
.flow ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 .875rem;
  border-left: 1px solid var(--border);
}
.flow ol li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: baseline;
  gap: .25rem .75rem;
  position: relative;
  padding-block: .45rem;
}
.flow ol li::before {
  position: absolute;
  inset: .97rem auto auto -1.11rem;
  width: .42rem;
  height: .42rem;
  background: var(--accent);
  content: "";
}
.flow ol li span { font-weight: 650; }
.flow ol li small, .flow p { color: var(--muted); font-size: .875rem; }
.flow p { margin-top: 1.1rem; }

.workspace { display: grid; gap: 1.6rem; }
.tool {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: .45rem;
  background: var(--surface);
  scroll-margin-top: 1.25rem;
}
.tool-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: start;
  gap: 1rem 1.5rem;
  padding: clamp(1rem, 3vw, 1.85rem);
}
h2 {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
.tool-header h2 + p { margin-top: .4rem; color: var(--muted); }
.model-spec {
  display: grid;
  gap: .15rem;
  margin-top: .12rem;
  border-left: 2px solid var(--accent);
  padding-left: .8rem;
  font-size: .875rem;
  line-height: 1.45;
}
.model-spec strong { font-family: var(--mono); font-weight: 650; }
.model-spec span { color: var(--muted); }

.model-bar {
  display: grid;
  grid-template-columns: minmax(12rem, max-content) minmax(0, 1fr);
  align-items: start;
  gap: .7rem 1.2rem;
  padding: 1rem clamp(1rem, 3vw, 1.85rem);
  border-block: 1px solid var(--border);
  background: var(--surface-alt);
}
.load-details { display: grid; gap: .45rem; min-width: 0; }
.status { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.progress-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  color: var(--muted);
  font: .875rem/1.35 var(--mono);
}
.progress-line span { white-space: nowrap; }
progress { flex: 1 1 10rem; max-width: 20rem; height: .55rem; accent-color: var(--accent); }
progress::-webkit-progress-bar { border-radius: .15rem; background: var(--track); }
progress::-webkit-progress-value { border-radius: .15rem; background: var(--accent); }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.input-pane, .output-pane, .network-body { min-width: 0; padding: clamp(1rem, 3vw, 1.85rem); }
.output-pane { border-left: 1px solid var(--border); }
.field + .field { margin-top: .95rem; }
h3, label { font-size: 1rem; font-weight: 680; }
label { display: block; margin-bottom: .3rem; }
button, select, textarea { font: inherit; }
select, textarea {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: .25rem;
  padding: .6rem .75rem;
  color: var(--ink);
  background: var(--surface);
}
select {
  appearance: none;
  padding-right: 2rem;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%) calc(100% - 17px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--ink) 50%, transparent 50%) calc(100% - 12px) 50% / 5px 5px no-repeat,
    var(--surface);
}
textarea { display: block; min-height: 10rem; resize: vertical; }
.help { margin-top: .45rem; color: var(--muted); font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: .9rem; }
button {
  min-height: 2.75rem;
  border: 1px solid var(--field-border);
  border-radius: .25rem;
  padding: .55rem .85rem;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.25;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
button:hover { background: var(--surface-alt); }
button.primary { border-color: var(--accent); color: var(--surface); background: var(--accent); }
button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
button:disabled {
  border-color: var(--border);
  color: var(--muted);
  background: var(--disabled);
  cursor: default;
}
button:disabled:hover { background: var(--disabled); }

.output-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .35rem .65rem;
  margin-bottom: .55rem;
}
.output-kind {
  max-width: 100%;
  color: var(--accent-dark);
  font-size: .875rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.output, .schema {
  min-width: 0;
  border: 0;
  border-left: 3px solid var(--border);
  padding: .85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-alt);
}
.output { min-height: 9rem; max-height: 26rem; overflow: auto; font: .875rem/1.55 var(--mono); }
.run-hint[hidden] { display: none; }
.output.transcript { min-height: 6.5rem; font: inherit; }
details { margin-top: .8rem; }
summary {
  min-height: 2.75rem;
  padding-block: .55rem;
  color: var(--accent-dark);
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
}
.schema { font: .875rem/1.5 var(--mono); }

audio { display: block; width: 100%; margin-block: .55rem .7rem; }
.network-body { border-top: 1px solid var(--border); }
.network-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .45rem 1rem;
  margin-bottom: .8rem;
}
.network-summary p { font-size: .9375rem; }
.network-total { color: var(--accent-dark); }
.network-total strong { font-family: var(--mono); }
.table-scroll { overflow: auto; max-height: 24rem; border-block: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; text-align: left; }
th, td { padding: .55rem .75rem; vertical-align: top; overflow-wrap: anywhere; }
th { position: sticky; top: 0; background: var(--surface-alt); }
td { border-top: 1px solid var(--border); }
td:last-child { word-break: break-word; }
td:first-child:not([colspan]) { min-width: 4.6rem; font-family: var(--mono); }
.network .help { margin-top: .7rem; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .35rem 1.25rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding-block: 1.1rem 1.5rem;
  color: var(--muted);
  font-size: .875rem;
}
.site-footer p:first-child { font-weight: 650; }
.no-script { margin-bottom: 1rem; }

/* Umgebungspruefung im Kopfbereich */
.env { list-style: none; margin: 1.1rem 0 0; padding: 0; display: grid; gap: .35rem; font-size: .875rem; color: var(--muted); }
.env li { padding-left: 1.1rem; position: relative; }
.env li::before { position: absolute; left: 0; top: .5em; width: .5rem; height: .5rem; border: 2px solid var(--muted); content: ""; }
.env li[data-state="ok"]::before { border-color: var(--ok); background: var(--ok); }
.env li[data-state="warn"]::before { border-color: var(--warn); }

.status[data-state="ok"] { color: var(--ok); }
.status[data-state="error"] { color: var(--error); }

/* Live- und Aufzeichnungsausgaben klar unterscheiden */
.output[data-kind="live"] { border-left-color: var(--accent); }
.output[data-kind="recorded"] { border-left: 3px dashed var(--warn); }
.output-kind[data-kind="recorded"] { color: var(--warn); }
.output-kind[data-kind="live"] { color: var(--accent-dark); }
.ai-note { margin-top: .55rem; color: var(--muted); font-size: .8125rem; }
.ai-note::before { content: "KI "; display: inline-block; margin-right: .4rem; padding: 0 .3rem; border: 1px solid var(--muted); border-radius: .15rem; font: 650 .6875rem/1.4 var(--mono); }

.validation { margin-top: .55rem; font-size: .875rem; }
.validation:empty { display: none; }
.validation-head { font-weight: 680; }
.validation.is-ok .validation-head { color: var(--ok); }
.validation.is-error .validation-head { color: var(--error); }
.validation ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.validation li { overflow-wrap: anywhere; }
.validation.is-error:not(:has(.validation-head)) { color: var(--error); }

.reference { padding: .2rem 0 .4rem; color: var(--muted); font-size: .9375rem; }

/* Netzwerk */
.network-status { font-size: 1.0625rem; font-weight: 600; max-width: 52rem; }
.network-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin: 1.1rem 0; }
.network-stats div { border-top: 2px solid var(--ink); padding-top: .45rem; }
.network-stats dt { color: var(--muted); font-size: .8125rem; }
.network-stats dd { margin: 0; font: 650 1.75rem/1.2 var(--mono); }
caption { padding: .55rem .75rem; text-align: left; font-weight: 680; background: var(--surface); }
tr.is-external td { color: var(--error); font-weight: 600; }
.network .help + .table-scroll { margin-top: .8rem; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (max-width: 52rem) {
  .hero { gap: 2.5rem; }
  .flow ol li { grid-template-columns: 1fr; row-gap: 0; }
}

@media (max-width: 40rem) {
  .shell { width: calc(100% - 1.75rem); }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 0; padding-block: .3rem; }
  .site-header nav { width: 100%; justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; gap: 1.45rem; }
  .hero-break { display: none; }
  h1 { font-size: clamp(2.95rem, 12vw, 4.5rem); line-height: .99; }
  .intro { margin-top: 1.05rem; }
  .flow ol li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
  .tool-header, .model-bar, .columns { grid-template-columns: minmax(0, 1fr); }
  .model-bar > button { justify-self: start; }
  .output-pane { border-top: 1px solid var(--border); border-left: 0; }
  th, td { padding-inline: .45rem; }
  .network-stats { grid-template-columns: 1fr; }
  .network-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
  .network-stats dd { font-size: 1.25rem; }
}

@media (forced-colors: active) {
  select { appearance: auto; background: Field; }
  .mark, .flow ol li::before { forced-color-adjust: none; }
}
