:root {
  --fnw-green: #05a535;
  --fnw-green-dark: #047d29;
  --fnw-green-soft: #ebf8ef;
  --fnw-green-mid: #82d29a;
  --surface: #ffffff;
  --surface-muted: #f5f7f5;
  --text: #1d241f;
  --text-muted: #5f6b62;
  --border: #dce4de;
  --danger: #b3261e;
  --shadow: 0 14px 38px rgba(22, 44, 28, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-muted);
  color: var(--text);
  font-family: "Barlow", "Arial Narrow", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand-link {
  display: flex;
  align-items: center;
  min-width: 240px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(460px, 42vw);
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 9px 13px;
  border-radius: 999px;
  color: #334138;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--fnw-green-soft);
  color: var(--fnw-green-dark);
  outline: none;
}

.site-nav a[aria-current="page"] {
  background: var(--fnw-green);
  color: #fff;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 56px;
}

.hero {
  display: block;
  margin-bottom: 18px;
}

.hero-copy,
.panel,
.tool-card,
.settings-card,
.file-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(28px, 5vw, 52px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fnw-green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: var(--fnw-green);
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.15;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.35rem, 6vw, 4.8rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.hero-copy p,
.lead {
  color: var(--text-muted);
}

.hero-copy p {
  max-width: 62ch;
  margin-bottom: 0;
  font-size: 1.08rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tool-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-card {
  position: relative;
  min-height: 230px;
  padding: 26px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--fnw-green-mid);
  box-shadow: 0 18px 45px rgba(22, 44, 28, 0.12);
  outline: none;
}

.tool-card .tool-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 36px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--fnw-green-soft);
  color: var(--fnw-green-dark);
}

.tool-card svg {
  width: 27px;
  height: 27px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-card h2 {
  margin-bottom: 8px;
}

.tool-card p {
  margin: 0;
  color: var(--text-muted);
}

.tool-arrow {
  position: absolute;
  right: 24px;
  bottom: 24px;
  color: var(--fnw-green);
  font-size: 1.5rem;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
}

.page-heading p {
  max-width: 76ch;
  margin: 0;
  color: var(--text-muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.panel,
.settings-card {
  padding: 22px;
}

.text-panel {
  min-height: 560px;
  display: flex;
  flex-direction: column;
}

.panel-header,
.settings-header,
.file-zone-header,
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h2,
.settings-header h2,
.file-zone-header h2,
.output-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.textfield {
  width: 100%;
  flex: 1;
  min-height: 440px;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfcfb;
  color: var(--text);
  outline: none;
  line-height: 1.6;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.textfield:focus {
  border-color: var(--fnw-green);
  box-shadow: 0 0 0 4px rgba(5, 165, 53, 0.12);
}

.settings-column {
  display: grid;
  gap: 18px;
}

.abbreviation-card {
  padding: 0;
  overflow: hidden;
}

.abbreviation-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 22px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.abbreviation-summary::-webkit-details-marker {
  display: none;
}

.settings-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
}

.disclosure-triangle {
  display: inline-block;
  color: var(--fnw-green-dark);
  font-size: 0.82rem;
  line-height: 1;
  transition: transform 160ms ease;
  transform-origin: center;
}

.abbreviation-card[open] .disclosure-triangle {
  transform: rotate(90deg);
}

.abbreviation-summary:hover .settings-title,
.abbreviation-summary:focus-visible .settings-title {
  color: var(--fnw-green-dark);
}

.abbreviation-summary:focus-visible {
  outline: 3px solid rgba(5, 165, 53, 0.18);
  outline-offset: -3px;
}

.abbreviation-content {
  padding: 0 22px 22px;
}

.option-list {
  display: grid;
  gap: 9px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 11px;
  transition: background-color 120ms ease;
}

.option-row:hover {
  background: var(--surface-muted);
}

.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--fnw-green);
}

.muted {
  color: var(--text-muted);
}

.abbreviation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.text-input,
.input-container {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
}

.text-input:focus,
.input-container:focus {
  border-color: var(--fnw-green);
  box-shadow: 0 0 0 3px rgba(5, 165, 53, 0.1);
}

.liste {
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  border-top: 1px solid var(--border);
}

.liste li {
  padding: 7px 3px;
  border-bottom: 1px solid #edf1ee;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.button-row,
.buttons,
#segmentButtons,
#countButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.buttons {
  margin-top: 18px;
  justify-content: space-between;
}

button,
.button,
.file-picker-label {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--fnw-green);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

button:hover,
.button:hover,
.file-picker-label:hover {
  background: var(--fnw-green-dark);
}

button:active,
.button:active,
.file-picker-label:active {
  transform: translateY(1px);
}

button.secondary,
.button.secondary {
  border-color: var(--border);
  background: #fff;
  color: #344139;
}

button.secondary:hover,
.button.secondary:hover {
  border-color: var(--fnw-green-mid);
  background: var(--fnw-green-soft);
  color: var(--fnw-green-dark);
}

button.danger {
  border-color: #f0d4d1;
  background: #fff;
  color: var(--danger);
}

button.danger:hover {
  background: #fff4f3;
}

button.small {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 0.9rem;
}

.word-count {
  display: none;
}

.word-count.is-visible {
  display: block;
}

#countTableBox {
  max-height: 410px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

#countTable {
  width: 100%;
  border-collapse: collapse;
}

#countTable th,
#countTable td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

#countTable th:last-child,
#countTable td:last-child {
  width: 90px;
  text-align: right;
}

#countTable thead th {
  position: sticky;
  top: 0;
  background: var(--fnw-green-soft);
  color: var(--fnw-green-dark);
}

.multi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.multi-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.file-zone {
  min-height: 500px;
  padding: 20px;
}

#inputArea.dragAndDropHover {
  border-color: var(--fnw-green);
  background: var(--fnw-green-soft);
}

.convert-space {
  display: grid;
  place-items: center;
}

.convert-button {
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.5rem;
}

.inputfile {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.file-picker-label {
  margin-bottom: 8px;
}

.file-hint {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.file-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fbfcfb;
}

.file-list.output-list li {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.file-list p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 34px 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  text-align: center;
}

.popup,
.Klammer {
  visibility: hidden;
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 13px 16px;
  border-radius: 12px;
  background: #26312a;
  color: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.popup.is-visible,
.Klammer.is-visible {
  visibility: visible;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--fnw-green-dark);
}

@media (max-width: 980px) {
  .header-inner {
    min-height: 84px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
    gap: 8px;
  }

  .brand-logo {
    width: min(530px, 85vw);
    max-height: 58px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .hero,
  .workspace,
  .multi-grid {
    grid-template-columns: 1fr;
  }

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

  .multi-workspace {
    grid-template-columns: 1fr;
  }

  .convert-space {
    min-height: 60px;
  }

  .convert-button {
    transform: rotate(90deg);
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 22px, 1180px);
    padding-top: 28px;
  }

  .header-inner,
  .site-footer {
    width: min(100% - 22px, 1180px);
  }

  .hero-copy,
  .panel,
  .settings-card,
  .file-zone {
    padding: 17px;
  }

  .abbreviation-card {
    padding: 0;
  }

  .abbreviation-summary {
    padding: 17px;
  }

  .abbreviation-content {
    padding: 0 17px 17px;
  }

  .buttons,
  #segmentButtons,
  #countButtons,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .file-list.output-list li {
    grid-template-columns: 1fr 1fr;
  }

  .file-list.output-list p {
    grid-column: 1 / -1;
  }
}

/* Robuster lokaler Text-Fallback, falls das offizielle FNW-Signet offline nicht geladen werden kann. */
.brand-link {
  position: relative;
  width: min(520px, 46vw);
  height: 72px;
}

.brand-fallback {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  color: var(--text);
}

.brand-fallback strong {
  display: grid;
  place-items: center;
  min-width: 78px;
  height: 46px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--fnw-green);
  color: #fff;
  letter-spacing: 0.08em;
}

.brand-fallback span {
  max-width: 240px;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
}

.brand-logo {
  position: relative;
  z-index: 1;
  width: auto;
  max-width: 100%;
  height: 72px;
  max-height: 72px;
  background: #fff;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4.2vw, 3.75rem);
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .brand-link {
    width: min(560px, 88vw);
    height: 58px;
  }

  .brand-logo {
    height: 58px;
    max-height: 58px;
  }

  .brand-fallback strong {
    height: 42px;
  }
}
