:root {
  --paper: #f3f3f1;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #626262;
  --line: #d8d8d4;
  --accent: #d71920;
  --accent-dark: #a90f14;
  --accent-soft: #fff1a8;
  --warning: #f4c300;
  --danger: #b00020;
  --shadow: 0 14px 34px rgba(0, 0, 0, .07);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.5 Arial, Helvetica, sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.site-header { background: #111; color: #fff; border-bottom: 6px solid var(--warning); }
.header-inner { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 28px; display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 6px; color: var(--warning); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 54px); font-weight: 800; line-height: 1.02; letter-spacing: -.03em; }
.lede { max-width: 720px; margin: 12px 0 0; color: #d8d8d8; font-size: 16px; }
.file-state { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.22); font-size: 13px; color: #eee; }
.state-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); }
.file-state.ok .state-dot { background: #fff; box-shadow: 0 0 0 3px var(--warning); }
.file-state.error .state-dot { background: var(--accent); }
.page-shell { width: min(1120px, calc(100% - 48px)); margin: 28px auto 48px; display: grid; gap: 20px; }
.workspace, .result-panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; overflow: hidden; }
.workspace { padding: 28px 30px 30px; }
.section-heading, .result-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.section-heading { margin-bottom: 18px; }
.section-heading > div, .result-head > div { display: flex; align-items: baseline; gap: 12px; }
.section-number { color: var(--accent); font: 800 12px/1 "Arial Narrow", Arial, sans-serif; letter-spacing: .12em; }
h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.015em; }
.text-button { border: 0; border-bottom: 2px solid var(--warning); padding: 2px 0; background: none; color: var(--ink); font-weight: 800; }
.field, .custom-offsets .field { min-width: 0; }
.text-button:hover { color: var(--accent); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.field { display: grid; gap: 7px; }
.field-label { font-weight: 800; font-size: 13px; letter-spacing: .01em; }
.field small, .switch-row small, .discipline-name small { color: var(--muted); font-size: 12px; min-height: 18px; }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid #aaa; background: #fff; }
.input-with-unit:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(215,25,32,.12); }
.input-with-unit input { width: 100%; border: 0; outline: 0; padding: 11px 12px; background: transparent; }
.input-with-unit > span { padding: 0 11px; color: var(--muted); border-left: 1px solid var(--line); font-size: 13px; }
.switch-row { margin: 20px 0 12px; padding: 13px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.switch-row > span:first-child { display: grid; gap: 2px; }
.switch { position: relative; width: 48px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; position: absolute; }
.switch span { display: block; width: 100%; height: 100%; border-radius: 30px; background: #aaa; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--accent); box-shadow: inset 0 0 0 2px #111; }
.switch input:checked + span::after { transform: translateX(22px); }
.custom-offsets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 6px 0 8px; }
.custom-offsets[hidden] { display: none; }
.discipline-heading { margin-top: 24px; padding-top: 22px; border-top: 3px solid var(--ink); align-items: end; }
.discipline-heading p { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.discipline-table { border-top: 1px solid var(--ink); }
.discipline-row { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, .9fr); align-items: center; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.discipline-name { display: flex; align-items: center; gap: 14px; min-width: 0; }
.discipline-name > div { display: grid; gap: 1px; }
.discipline-icon { width: 48px; height: 48px; display: block; border-radius: 10px; border: 0; background: #fff; object-fit: cover; flex: 0 0 auto; box-shadow: 0 0 0 1px #e3e3df; }
.discipline-row input { width: 100%; height: 44px; border: 1px solid #aaa; padding: 10px 12px; outline: 0; background: #fffdf6; }
.discipline-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(215,25,32,.12); }
.form-footer { margin-top: 22px; display: flex; justify-content: flex-end; }
.primary-button, .download-button { border: 2px solid #111; padding: 12px 18px; background: var(--accent); color: #fff; font-weight: 800; box-shadow: 4px 4px 0 var(--warning); }
.primary-button:hover, .download-button:hover { background: var(--accent-dark); }
.primary-button:disabled, .download-button:disabled { cursor: not-allowed; background: #aaa; color: #eee; box-shadow: none; border-color: #777; }
.result-head { padding: 17px 22px; border-bottom: 1px solid var(--line); }
.download-button { padding: 10px 14px; }
.result-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.download-button-secondary { background: #fff; color: var(--ink); box-shadow: 4px 4px 0 #cfcfca; }
.download-button-secondary:hover { background: #f1f1ed; color: var(--accent-dark); }
.download-button-secondary:disabled { background: #ededeb; color: #8a8a86; }
.result-status { padding: 14px 22px; color: var(--muted); font-size: 13px; border-left: 6px solid var(--warning); background: #fffef6; }
.result-status.error { color: var(--danger); border-left-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
@media (max-width: 720px) {
  .header-inner, .page-shell { width: min(100% - 24px, 1120px); }
  .header-inner { align-items: start; flex-direction: column; }
  .workspace { padding: 20px; }
  .settings-grid, .custom-offsets { grid-template-columns: 1fr 1fr; }
  .field-wide { grid-column: 1 / -1; }
  .discipline-row { grid-template-columns: 1fr; gap: 10px; }
  .form-footer { justify-content: stretch; }
  .primary-button { width: 100%; }
  .result-head { align-items: stretch; flex-direction: column; }
  .result-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .download-button { width: 100%; }
}

@media (min-width: 721px) {
  .result-panel { max-width: 1120px; }
}


.field-disabled {
  opacity: .48;
}
.field-disabled .input-with-unit {
  background: #ededeb;
  border-color: #c9c9c5;
  box-shadow: none;
}
.field-disabled input:disabled {
  cursor: not-allowed;
  color: #777;
  -webkit-text-fill-color: #777;
  opacity: 1;
}


/* Parametergruppen */
.parameter-groups {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(0, 1.6fr);
  gap: 16px;
  margin-top: 2px;
}
.parameter-block,
.sector-spacing-block {
  position: relative;
  padding: 17px 18px 18px;
  border: 1px solid #e1c85a;
  border-left: 6px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(135deg, #fffdf0 0%, #fff8c9 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.parameter-heading,
.sector-spacing-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
}
.parameter-heading strong,
.sector-spacing-heading strong {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}
.parameter-heading small,
.sector-spacing-heading small {
  color: #625b37;
  font-size: 12px;
}
.parameter-grid-two,
.sector-spacing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.sector-spacing-block { margin-top: 16px; }
.sector-spacing-grid { max-width: 700px; }

/* Eingabefelder innerhalb der Parametergruppen */
.parameter-block .field,
.sector-spacing-block .field {
  gap: 7px;
}
.parameter-block .field-label,
.sector-spacing-block .field-label {
  color: var(--ink);
}
.parameter-block .input-with-unit,
.sector-spacing-block .input-with-unit {
  height: 44px;
  border: 1px solid #8e8a70;
  border-bottom: 3px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(0,0,0,.04);
}
.parameter-block .input-with-unit:focus-within,
.sector-spacing-block .input-with-unit:focus-within {
  border-color: var(--accent);
  border-bottom-color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(215,25,32,.15);
}
.parameter-block .input-with-unit input,
.sector-spacing-block .input-with-unit input {
  min-width: 0;
  height: 41px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}
.parameter-block .input-with-unit > span,
.sector-spacing-block .input-with-unit > span {
  height: 100%;
  display: grid;
  place-items: center;
  min-width: 46px;
  padding: 0 11px;
  color: var(--accent-dark);
  font-weight: 800;
  background: #fff4a8;
  border-left: 1px solid #dfca65;
}
.parameter-block .field > small,
.sector-spacing-block .field > small {
  min-height: 18px;
  color: #655f43;
}

/* Kompakte Disziplinzeilen und feste Piktogrammgröße */
.discipline-row {
  min-height: 66px;
  padding: 9px 0;
}
.discipline-icon {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: cover;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 1px #e3e3df;
  flex: 0 0 48px;
}
.discipline-row input {
  height: 44px;
  border-radius: 8px;
  border-bottom: 3px solid var(--accent);
}

@media (max-width: 820px) {
  .parameter-groups { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .parameter-grid-two,
  .sector-spacing-grid { grid-template-columns: 1fr; max-width: none; }
  .parameter-block,
  .sector-spacing-block { padding: 15px; }
}


/* Ergebnisdetails der erzeugten Weitenlinien */
.result-details { padding: 20px 22px 24px; border-top: 1px solid var(--line); }
.result-details[hidden] { display: none; }
.result-details-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.result-details-heading h3 { margin: 0; font-size: 17px; font-weight: 800; }
.result-details-heading p { margin: 0; color: var(--muted); font-size: 12px; text-align: right; }
.result-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.result-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.result-table th, .result-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.result-table th { background: #f5f5f2; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.result-table tbody tr:last-child td { border-bottom: 0; }
.result-table td:nth-child(2), .result-table td:nth-child(3),
.result-table th:nth-child(2), .result-table th:nth-child(3) { text-align: right; }
.result-table td strong { color: var(--accent-dark); }

@media (max-width: 720px) {
  .result-details-heading { align-items: start; flex-direction: column; gap: 4px; }
  .result-details-heading p { text-align: left; }
}

/* Gut sichtbare Fehlermeldung als modaler Dialog */
.error-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  overflow: visible;
  color: var(--ink);
  background: transparent;
  border: 0;
}
.error-dialog::backdrop {
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
}
.error-dialog-card {
  overflow: hidden;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-top: 8px solid var(--accent);
  border-radius: 16px;
  box-shadow: 10px 10px 0 var(--warning), 0 24px 70px rgba(0, 0, 0, .32);
}
.error-dialog-head {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 17px;
  border-bottom: 1px solid var(--line);
}
.error-dialog-symbol {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 27px;
  font-weight: 900;
  line-height: 1;
}
.error-dialog-eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.error-dialog-head h2 {
  margin: 0;
  font-size: 22px;
}
.error-dialog-close {
  align-self: start;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: #f0f0ed;
  font-size: 27px;
  line-height: 34px;
}
.error-dialog-close:hover,
.error-dialog-close:focus-visible {
  color: #fff;
  background: var(--accent);
  outline: 3px solid rgba(215, 25, 32, .18);
}
.error-dialog-message {
  max-height: min(320px, 48vh);
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  color: #333;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-line;
}
.error-dialog-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 22px 22px;
}
.error-dialog-button {
  min-width: 140px;
  padding: 11px 18px;
  color: #fff;
  background: var(--accent);
  border: 2px solid var(--ink);
  font-weight: 800;
  box-shadow: 4px 4px 0 var(--warning);
}
.error-dialog-button:hover,
.error-dialog-button:focus-visible {
  background: var(--accent-dark);
  outline: 3px solid rgba(215, 25, 32, .18);
}
@media (max-width: 520px) {
  .error-dialog-card { box-shadow: 6px 6px 0 var(--warning); }
  .error-dialog-head { grid-template-columns: auto 1fr auto; padding: 18px 16px 14px; gap: 10px; }
  .error-dialog-symbol { width: 38px; height: 38px; font-size: 23px; }
  .error-dialog-head h2 { font-size: 19px; }
  .error-dialog-message { padding: 18px 16px; }
  .error-dialog-actions { padding: 0 16px 18px; }
  .error-dialog-button { width: 100%; }
}

/* Smartphone-Optimierung */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-width: 0;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
button,
input {
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
.switch input:focus-visible + span {
  outline: 3px solid rgba(215, 25, 32, .22);
  outline-offset: 2px;
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  body {
    font-size: 17px;
    line-height: 1.48;
  }

  .site-header {
    border-bottom-width: 5px;
  }
  .header-inner,
  .page-shell {
    width: auto;
    max-width: none;
    margin-left: max(12px, env(safe-area-inset-left));
    margin-right: max(12px, env(safe-area-inset-right));
  }
  .header-inner {
    padding: 22px 2px 20px;
  }
  .eyebrow {
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: .13em;
  }
  h1 {
    font-size: clamp(34px, 9vw, 48px);
    line-height: 1.04;
  }
  .lede {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.45;
  }

  .page-shell {
    margin-top: 14px;
    margin-bottom: 28px;
    gap: 14px;
  }
  .workspace,
  .result-panel {
    border-radius: 13px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .06);
  }
  .workspace {
    padding: 20px 15px 22px;
  }

  .section-heading,
  .discipline-heading,
  .result-head {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .section-heading {
    margin-bottom: 14px;
  }
  .section-heading > div,
  .result-head > div:first-child {
    align-items: center;
    gap: 9px;
  }
  .section-number {
    flex: 0 0 auto;
  }
  h2 {
    font-size: 23px;
    line-height: 1.15;
  }
  .text-button {
    align-self: flex-start;
    min-height: 46px;
    padding: 9px 0 6px;
    font-size: 15px;
  }

  .parameter-groups,
  .parameter-grid-two,
  .sector-spacing-grid,
  .custom-offsets {
    grid-template-columns: minmax(0, 1fr);
  }
  .parameter-groups {
    gap: 12px;
  }
  .parameter-block,
  .sector-spacing-block {
    padding: 14px 13px 15px;
    border-left-width: 5px;
    border-radius: 10px;
  }
  .sector-spacing-block {
    margin-top: 12px;
  }
  .parameter-heading,
  .sector-spacing-heading {
    margin-bottom: 12px;
  }
  .parameter-heading strong,
  .sector-spacing-heading strong {
    font-size: 17px;
  }
  .parameter-heading small,
  .sector-spacing-heading small,
  .field small,
  .switch-row small,
  .discipline-name small {
    font-size: 13px;
    line-height: 1.45;
    min-height: 0;
  }
  .field {
    gap: 6px;
  }
  .field-label {
    font-size: 15px;
  }
  .input-with-unit,
  .parameter-block .input-with-unit,
  .sector-spacing-block .input-with-unit {
    min-height: 54px;
    height: 54px;
  }
  .input-with-unit input,
  .parameter-block .input-with-unit input,
  .sector-spacing-block .input-with-unit input,
  .discipline-row input {
    min-height: 51px;
    height: 51px;
    padding: 12px 13px;
    font-size: 17px;
  }
  .input-with-unit > span,
  .parameter-block .input-with-unit > span,
  .sector-spacing-block .input-with-unit > span {
    min-width: 54px;
    font-size: 15px;
  }

  .switch-row {
    margin: 16px 0 12px;
    padding: 14px 0;
    align-items: flex-start;
    gap: 14px;
  }
  .switch-row > span:first-child {
    padding-right: 2px;
  }
  .switch-row strong {
    line-height: 1.3;
  }
  .switch {
    width: 54px;
    height: 30px;
    margin-top: 2px;
  }
  .switch span::after {
    width: 24px;
    height: 24px;
  }
  .switch input:checked + span::after {
    transform: translateX(24px);
  }
  .custom-offsets {
    gap: 12px;
    padding-top: 4px;
  }

  .discipline-heading {
    margin-top: 20px;
    padding-top: 18px;
    gap: 7px;
  }
  .discipline-heading p {
    max-width: none;
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
  }
  .discipline-table {
    display: grid;
    gap: 10px;
    border-top: 0;
  }
  .discipline-row {
    min-height: 0;
    padding: 12px;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafaf8;
  }
  .discipline-name {
    gap: 11px;
  }
  .discipline-icon {
    width: 44px !important;
    height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    flex-basis: 44px;
  }
  .discipline-name strong {
    font-size: 18px;
  }
  .discipline-row input {
    border-bottom-width: 3px;
    background: #fff;
  }

  .form-footer {
    margin-top: 18px;
  }
  .primary-button,
  .download-button,
  .error-dialog-button {
    min-height: 54px;
    padding: 13px 16px;
    font-size: 17px;
    border-radius: 7px;
  }
  .primary-button {
    width: 100%;
  }

  .result-head {
    padding: 16px 14px;
  }
  .result-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .download-button {
    width: 100%;
    white-space: normal;
  }
  .result-status {
    padding: 14px;
    border-left-width: 5px;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  .result-details {
    padding: 16px 14px 18px;
  }
  .result-details-heading {
    margin-bottom: 10px;
  }
  .result-details-heading h3 {
    font-size: 19px;
  }

  /* Tabelle wird auf Smartphones als Kartenliste angezeigt. */
  .result-table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  .result-table {
    min-width: 0;
    display: block;
  }
  .result-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .result-table tbody {
    display: grid;
    gap: 9px;
  }
  .result-table tr {
    display: grid;
    gap: 6px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--warning);
    border-radius: 9px;
    background: #fffef8;
  }
  .result-table td,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    display: grid;
    grid-template-columns: minmax(105px, .9fr) minmax(0, 1.1fr);
    gap: 10px;
    padding: 0;
    text-align: right;
    border: 0;
    overflow-wrap: anywhere;
  }
  .result-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }
  .result-table td:first-child {
    font-weight: 800;
  }
  .result-table td strong {
    font-size: 18px;
  }

  .error-dialog {
    width: auto;
    max-width: none;
    max-height: none;
    margin: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .error-dialog-card {
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    border-width: 2px;
    border-top-width: 7px;
    border-radius: 13px;
    box-shadow: 5px 5px 0 var(--warning);
  }
  .error-dialog-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 15px 13px 13px;
  }
  .error-dialog-head h2 {
    font-size: 19px;
    line-height: 1.15;
  }
  .error-dialog-symbol {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }
  .error-dialog-close {
    width: 42px;
    height: 42px;
    margin: -4px -5px 0 0;
    line-height: 40px;
  }
  .error-dialog-message {
    flex: 1 1 auto;
    max-height: none;
    padding: 16px 13px;
    font-size: 15px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .error-dialog-actions {
    flex: 0 0 auto;
    padding: 0 13px 15px;
  }
  .error-dialog-button {
    width: 100%;
  }
}


/* Fallback für Mobilbrowser mit aktivierter Desktop-Website. */
html.mobile-device .header-inner,
html.mobile-device .page-shell {
  width: auto;
  max-width: none;
}
html.mobile-device body {
  min-width: 0;
}

@media (max-width: 380px) {
  .header-inner,
  .page-shell {
    margin-left: max(8px, env(safe-area-inset-left));
    margin-right: max(8px, env(safe-area-inset-right));
  }
  .workspace {
    padding-left: 11px;
    padding-right: 11px;
  }
  h1 {
    font-size: 28px;
  }
  h2 {
    font-size: 19px;
  }
  .parameter-block,
  .sector-spacing-block,
  .discipline-row {
    padding-left: 11px;
    padding-right: 11px;
  }
  .result-table td,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    grid-template-columns: minmax(92px, .85fr) minmax(0, 1.15fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Deutlich vergrößerte Smartphone-Darstellung */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  body {
    font-size: 21px;
    line-height: 1.58;
  }

  .header-inner,
  .page-shell {
    margin-left: max(14px, env(safe-area-inset-left));
    margin-right: max(14px, env(safe-area-inset-right));
  }
  .header-inner {
    padding-top: 28px;
    padding-bottom: 26px;
  }
  .eyebrow {
    font-size: 15px;
    line-height: 1.3;
    letter-spacing: .11em;
  }
  h1 {
    font-size: clamp(44px, 10vw, 62px);
    line-height: 1.06;
  }
  .lede {
    margin-top: 14px;
    font-size: 20px;
    line-height: 1.55;
  }

  .page-shell {
    margin-top: 18px;
    margin-bottom: 36px;
    gap: 18px;
  }
  .workspace {
    padding: 25px 19px 28px;
  }
  .workspace,
  .result-panel {
    border-radius: 16px;
  }

  .section-heading,
  .discipline-heading,
  .result-head {
    gap: 14px;
  }
  .section-heading {
    margin-bottom: 20px;
  }
  .section-heading > div,
  .result-head > div:first-child {
    gap: 12px;
  }
  .section-number {
    font-size: 15px;
  }
  h2 {
    font-size: 31px;
    line-height: 1.18;
  }
  .text-button {
    min-height: 54px;
    padding: 11px 0 8px;
    font-size: 19px;
  }

  .parameter-groups {
    gap: 16px;
  }
  .parameter-block,
  .sector-spacing-block {
    padding: 19px 17px 20px;
    border-left-width: 7px;
    border-radius: 13px;
  }
  .sector-spacing-block {
    margin-top: 16px;
  }
  .parameter-heading,
  .sector-spacing-heading {
    gap: 6px;
    margin-bottom: 16px;
  }
  .parameter-heading strong,
  .sector-spacing-heading strong {
    font-size: 22px;
    line-height: 1.3;
  }
  .parameter-heading small,
  .sector-spacing-heading small,
  .field small,
  .switch-row small,
  .discipline-name small {
    font-size: 17px;
    line-height: 1.52;
  }
  .field {
    gap: 9px;
  }
  .field-label {
    font-size: 19px;
    line-height: 1.35;
  }

  .input-with-unit,
  .parameter-block .input-with-unit,
  .sector-spacing-block .input-with-unit {
    min-height: 66px;
    height: 66px;
    border-radius: 11px;
  }
  .input-with-unit input,
  .parameter-block .input-with-unit input,
  .sector-spacing-block .input-with-unit input,
  .discipline-row input {
    min-height: 63px;
    height: 63px;
    padding: 14px 16px;
    font-size: 22px;
    line-height: 1.2;
  }
  .input-with-unit > span,
  .parameter-block .input-with-unit > span,
  .sector-spacing-block .input-with-unit > span {
    min-width: 66px;
    padding: 0 15px;
    font-size: 19px;
  }

  .switch-row {
    margin: 21px 0 16px;
    padding: 18px 0;
    gap: 17px;
  }
  .switch-row strong {
    font-size: 21px;
    line-height: 1.35;
  }
  .switch {
    width: 68px;
    height: 38px;
    margin-top: 3px;
  }
  .switch span::after {
    width: 30px;
    height: 30px;
    left: 4px;
    top: 4px;
  }
  .switch input:checked + span::after {
    transform: translateX(30px);
  }
  .custom-offsets {
    gap: 16px;
  }

  .discipline-heading {
    margin-top: 27px;
    padding-top: 24px;
    gap: 10px;
  }
  .discipline-heading p {
    font-size: 17px;
    line-height: 1.55;
  }
  .discipline-table {
    gap: 14px;
  }
  .discipline-row {
    padding: 17px;
    gap: 14px;
    border-radius: 13px;
  }
  .discipline-name {
    gap: 15px;
  }
  .discipline-icon {
    width: 58px !important;
    height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
    flex-basis: 58px;
  }
  .discipline-name strong {
    font-size: 23px;
    line-height: 1.3;
  }

  .form-footer {
    margin-top: 24px;
  }
  .primary-button,
  .download-button,
  .error-dialog-button {
    min-height: 66px;
    padding: 16px 19px;
    font-size: 21px;
    line-height: 1.25;
    border-radius: 9px;
  }

  .result-head {
    padding: 21px 18px;
  }
  .result-actions {
    gap: 14px;
  }
  .result-status {
    padding: 18px;
    border-left-width: 7px;
    font-size: 19px;
    line-height: 1.55;
  }
  .result-details {
    padding: 21px 18px 24px;
  }
  .result-details-heading {
    margin-bottom: 14px;
  }
  .result-details-heading h3 {
    font-size: 25px;
    line-height: 1.3;
  }
  .result-table tbody {
    gap: 13px;
  }
  .result-table tr {
    gap: 9px;
    padding: 16px;
    border-left-width: 7px;
    border-radius: 12px;
  }
  .result-table td,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    grid-template-columns: minmax(130px, .9fr) minmax(0, 1.1fr);
    gap: 13px;
    font-size: 20px;
    line-height: 1.4;
  }
  .result-table td::before {
    font-size: 17px;
    line-height: 1.4;
  }
  .result-table td strong {
    font-size: 23px;
  }

  .error-dialog-head {
    padding: 20px 17px 17px;
    gap: 13px;
  }
  .error-dialog-head h2 {
    font-size: 27px;
  }
  .error-dialog-eyebrow {
    font-size: 14px;
  }
  .error-dialog-symbol {
    width: 48px;
    height: 48px;
    font-size: 29px;
  }
  .error-dialog-close {
    width: 52px;
    height: 52px;
    font-size: 34px;
    line-height: 49px;
  }
  .error-dialog-message {
    padding: 21px 17px;
    font-size: 20px;
    line-height: 1.58;
  }
  .error-dialog-actions {
    padding: 0 17px 20px;
  }
}

/* Auch bei aktivierter Desktop-Website auf einem erkannten Mobilgerät groß darstellen. */
html.mobile-device body {
  font-size: 21px;
}

/* Sehr große Smartphone-Darstellung für hochauflösende Geräte */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  body {
    font-size: 27px;
    line-height: 1.55;
  }

  .header-inner,
  .page-shell {
    margin-left: max(10px, env(safe-area-inset-left));
    margin-right: max(10px, env(safe-area-inset-right));
  }
  .header-inner {
    padding: 30px 5px 28px;
  }
  .eyebrow {
    margin-bottom: 10px;
    font-size: 17px;
    line-height: 1.3;
  }
  h1 {
    font-size: clamp(52px, 14vw, 78px);
    line-height: 1.02;
  }
  .lede {
    margin-top: 16px;
    font-size: 24px;
    line-height: 1.5;
  }

  .page-shell {
    margin-top: 18px;
    margin-bottom: 38px;
    gap: 20px;
  }
  .workspace {
    padding: 30px 22px 34px;
  }
  .workspace,
  .result-panel {
    border-radius: 18px;
  }

  .section-heading,
  .discipline-heading,
  .result-head {
    gap: 16px;
  }
  .section-heading {
    margin-bottom: 26px;
  }
  .section-heading > div,
  .result-head > div:first-child {
    gap: 15px;
  }
  .section-number {
    font-size: 20px;
  }
  h2 {
    font-size: 40px;
    line-height: 1.16;
  }
  .text-button {
    min-height: 70px;
    padding: 15px 0 12px;
    font-size: 26px;
  }

  .parameter-groups,
  .parameter-grid-two,
  .sector-spacing-grid,
  .custom-offsets {
    gap: 22px;
  }
  .parameter-block,
  .sector-spacing-block {
    padding: 26px 22px 28px;
    border-left-width: 9px;
    border-radius: 18px;
  }
  .sector-spacing-block {
    margin-top: 22px;
  }
  .parameter-heading,
  .sector-spacing-heading {
    gap: 9px;
    margin-bottom: 23px;
  }
  .parameter-heading strong,
  .sector-spacing-heading strong {
    font-size: 30px;
    line-height: 1.3;
  }
  .parameter-heading small,
  .sector-spacing-heading small,
  .field small,
  .switch-row small,
  .discipline-name small {
    font-size: 22px;
    line-height: 1.55;
  }
  .field {
    gap: 13px;
  }
  .field-label {
    font-size: 26px;
    line-height: 1.35;
  }

  .input-with-unit,
  .parameter-block .input-with-unit,
  .sector-spacing-block .input-with-unit {
    min-height: 86px;
    height: 86px;
    border-width: 2px;
    border-bottom-width: 5px;
    border-radius: 15px;
  }
  .input-with-unit input,
  .parameter-block .input-with-unit input,
  .sector-spacing-block .input-with-unit input,
  .discipline-row input {
    min-height: 81px;
    height: 81px;
    padding: 18px 20px;
    font-size: 30px;
    line-height: 1.2;
  }
  .input-with-unit > span,
  .parameter-block .input-with-unit > span,
  .sector-spacing-block .input-with-unit > span {
    min-width: 84px;
    padding: 0 18px;
    font-size: 25px;
  }

  .switch-row {
    margin: 30px 0 22px;
    padding: 25px 0;
    gap: 22px;
  }
  .switch-row strong {
    font-size: 29px;
    line-height: 1.35;
  }
  .switch {
    width: 84px;
    height: 48px;
    margin-top: 5px;
  }
  .switch span::after {
    width: 38px;
    height: 38px;
    left: 5px;
    top: 5px;
  }
  .switch input:checked + span::after {
    transform: translateX(36px);
  }

  .discipline-heading {
    margin-top: 36px;
    padding-top: 32px;
    gap: 15px;
  }
  .discipline-heading p {
    font-size: 22px;
    line-height: 1.55;
  }
  .discipline-table {
    gap: 20px;
  }
  .discipline-row {
    padding: 24px;
    gap: 20px;
    border-radius: 18px;
  }
  .discipline-name {
    gap: 20px;
  }
  .discipline-icon {
    width: 78px !important;
    height: 78px !important;
    max-width: 78px !important;
    max-height: 78px !important;
    flex-basis: 78px;
    border-radius: 15px;
  }
  .discipline-name strong {
    font-size: 32px;
    line-height: 1.25;
  }

  .form-footer {
    margin-top: 34px;
  }
  .primary-button,
  .download-button,
  .error-dialog-button {
    min-height: 84px;
    padding: 20px 24px;
    font-size: 29px;
    line-height: 1.25;
    border-radius: 13px;
    border-width: 3px;
    box-shadow: 6px 6px 0 var(--warning);
  }

  .result-head {
    padding: 28px 22px;
  }
  .result-actions {
    gap: 19px;
  }
  .result-status {
    padding: 24px 22px;
    border-left-width: 9px;
    font-size: 26px;
    line-height: 1.55;
  }
  .result-details {
    padding: 28px 22px 32px;
  }
  .result-details-heading {
    margin-bottom: 20px;
  }
  .result-details-heading h3 {
    font-size: 34px;
    line-height: 1.3;
  }
  .result-table tbody {
    gap: 18px;
  }
  .result-table tr {
    gap: 13px;
    padding: 22px;
    border-left-width: 9px;
    border-radius: 17px;
  }
  .result-table td,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3) {
    grid-template-columns: minmax(145px, .9fr) minmax(0, 1.1fr);
    gap: 16px;
    font-size: 27px;
    line-height: 1.45;
  }
  .result-table td::before {
    font-size: 22px;
    line-height: 1.4;
  }
  .result-table td strong {
    font-size: 31px;
  }

  .error-dialog-card {
    width: min(96vw, 720px);
    border-radius: 18px;
  }
  .error-dialog-head {
    padding: 27px 22px 23px;
    gap: 18px;
  }
  .error-dialog-head h2 {
    font-size: 36px;
  }
  .error-dialog-eyebrow {
    font-size: 18px;
  }
  .error-dialog-symbol {
    width: 64px;
    height: 64px;
    font-size: 39px;
  }
  .error-dialog-close {
    width: 66px;
    height: 66px;
    font-size: 43px;
    line-height: 62px;
  }
  .error-dialog-message {
    padding: 28px 22px;
    font-size: 27px;
    line-height: 1.58;
  }
  .error-dialog-actions {
    padding: 0 22px 27px;
  }
}

html.mobile-device body {
  font-size: 27px;
}

/* Mobile Ergebnisdarstellung: Bogenlängen auch auf Smartphones als echte Tabelle */
@media (max-width: 1200px), (hover: none) and (pointer: coarse) {
  .result-table-wrap {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
  }

  .result-table {
    display: table;
    width: 100%;
    min-width: 840px;
    border-collapse: collapse;
    table-layout: auto;
  }

  .result-table thead {
    display: table-header-group;
  }

  .result-table tbody {
    display: table-row-group;
  }

  .result-table tr {
    display: table-row;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .result-table th,
  .result-table td,
  .result-table td:nth-child(2),
  .result-table td:nth-child(3),
  .result-table th:nth-child(2),
  .result-table th:nth-child(3) {
    display: table-cell;
    grid-template-columns: none;
    gap: 0;
    padding: 22px 24px;
    border: 0;
    border-bottom: 2px solid var(--line);
    font-size: 26px;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
  }

  .result-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f5f5f2;
    color: var(--muted);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: .02em;
  }

  .result-table td:first-child,
  .result-table th:first-child {
    text-align: left;
  }

  .result-table td:nth-child(2),
  .result-table td:nth-child(3),
  .result-table th:nth-child(2),
  .result-table th:nth-child(3) {
    text-align: right;
  }

  .result-table td::before {
    display: none;
    content: none;
  }

  .result-table td strong {
    font-size: 28px;
  }

  .result-table tbody tr:last-child td {
    border-bottom: 0;
  }
}
