/**
 * ANSI Art Converter — Style
 * (c) 2026 Eric Bernstein
 */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0a0a0e;
  color: #d0d0d0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
a { color: #6699ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout Container --- */
header, main, footer {
  width: 100%;
  max-width: 900px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* --- Header --- */
header { padding-block: 24px 16px; }
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
h1 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: #f0f0f0;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  font-size: 0.9rem;
  color: #aaa;
  margin-block-start: 4px;
}

/* --- Language Switcher --- */
.lang-switch {
  flex-shrink: 0;
}
.lang-switch select {
  background: #16161e;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 32px 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%23aaa' stroke='%23aaa' stroke-width='0.5' d='M2 2l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.lang-switch select:focus { outline: none; border-color: #5588ff; }

/* --- Upload Section --- */
.upload-section {
  margin-block-end: 20px;
}
.drop-zone {
  border: 2px dashed #333;
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.over {
  border-color: #5588ff;
  background: rgba(85, 136, 255, 0.06);
}
.drop-zone:focus-visible {
  outline: 2px solid #5588ff;
  outline-offset: 2px;
}
.drop-icon {
  font-size: 2.5rem;
  margin-block-end: 8px;
  opacity: 0.6;
}
.drop-zone p { color: #aaa; font-size: 0.95rem; }
.drop-zone .hint { color: #777; font-size: 0.8rem; margin-block-start: 6px; }
input[type="file"] { display: none; }

/* --- Presets --- */
.presets-section { margin-block-end: 16px; }
.presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.preset {
  background: #14141c;
  border: 2px solid #252530;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #ccc;
  font-family: inherit;
  font-size: inherit;
}
.preset:hover {
  border-color: #5588ff;
  background: #1a1a28;
}
.preset:active { transform: scale(0.97); }
.preset.active {
  border-color: #5588ff;
  background: rgba(85, 136, 255, 0.1);
  box-shadow: 0 0 12px rgba(85, 136, 255, 0.15);
}
.preset:focus-visible {
  outline: 2px solid #5588ff;
  outline-offset: 2px;
}
.preset-icon { font-size: 1.5rem; }
.preset-name { font-weight: 600; font-size: 0.9rem; }
.preset-desc { font-size: 0.72rem; color: #888; line-height: 1.3; }

/* --- Advanced Settings --- */
.settings-section { margin-block-end: 16px; }
.advanced {
  background: #12121a;
  border: 1px solid #252530;
  border-radius: 12px;
}
.advanced summary {
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #999;
  user-select: none;
  list-style: none;
}
.advanced summary::before {
  content: '▶';
  font-size: 1.1em;
  margin-inline-end: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
.advanced[open] summary::before {
  transform: rotate(90deg);
}
.advanced summary:focus-visible {
  outline: 2px solid #5588ff;
  outline-offset: -2px;
}
.controls {
  padding: 12px 18px 18px;
}
.controls fieldset {
  border: none;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.controls fieldset.group {
  border: 1px solid #1e1e28;
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-block-end: 12px;
  position: relative;
}
.controls fieldset.group:last-child { margin-block-end: 0; }
.controls fieldset.group legend {
  color: #88a;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 6px;
  margin-inline-start: 4px;
}
.checkbox-label {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer;
  padding-block: 6px;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5588ff;
  cursor: pointer;
  flex-shrink: 0;
}
.palette-input-wrap {
  flex: 1 1 100%;
}
.palette-textarea {
  resize: vertical;
  min-height: 48px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}
.palette-apply {
  padding: 6px 14px !important;
  font-size: 0.8rem !important;
  align-self: flex-end;
  min-height: auto;
}
.palette-apply[hidden] { display: none; }
.palette-status {
  color: #888;
  font-size: 0.75rem;
  align-self: center;
}

/* --- Tooltipps --- */
.label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2a2a38;
  color: #7a7a9a;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: help;
  position: relative;
  user-select: none;
  border: 1px solid #333;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tip:hover,
.tip:focus {
  background: #5588ff;
  color: #fff;
  border-color: #5588ff;
  outline: none;
}
.tip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #101018;
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 400;
  color: #d0d0d0;
  width: max-content;
  max-width: 300px;
  line-height: 1.55;
  white-space: normal;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
  cursor: default;
}
.tip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #3a3a4a;
}
.tip-content::before {
  content: '';
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #101018;
  z-index: 1;
}
.tip:hover .tip-content,
.tip:focus .tip-content,
.tip:focus-within .tip-content {
  opacity: 1;
  visibility: visible;
}
/* JS-gesetzte Ausrichtungen, wenn zentrierter Tooltip aus dem Viewport
   ragen wuerde. Pfeil bleibt am (?)-Kreis. */
.tip-content.tip-align-start {
  left: 0;
  transform: none;
}
.tip-content.tip-align-start::after,
.tip-content.tip-align-start::before {
  left: 8px;
  transform: none;
}
.tip-content.tip-align-end {
  left: auto;
  right: 0;
  transform: none;
}
.tip-content.tip-align-end::after,
.tip-content.tip-align-end::before {
  left: auto;
  right: 8px;
  transform: none;
}
/* Mobile: aggressiver zusammenstauchen — die dynamische Ausrichtung oben
   greift ebenfalls, aber zusaetzlich die Breite begrenzen. */
@media (max-width: 640px) {
  .tip-content {
    max-width: calc(100vw - 40px);
  }
}
.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #bbb;
}
.controls select {
  background: #1a1a24;
  color: #ddd;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 36px 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 38px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M1.5 1.5l4.5 5 4.5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
}
.controls select:focus { outline: none; border-color: #5588ff; }
.controls select:disabled { opacity: 0.3; cursor: default; }
.custom-input {
  background: #1a1a24;
  color: #ddd;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  min-height: 38px;
  width: 100%;
  font-family: inherit;
  margin-block-start: 4px;
}
.custom-input:focus { outline: none; border-color: #5588ff; }
.custom-input[hidden] { display: none; }
/* Prozent-Suffix bei Helligkeit/Sättigung/Kontrast */
.percent-wrap {
  position: relative;
  display: block;
}
.percent-wrap > .custom-input {
  padding-inline-end: 28px;
}
.percent-wrap > .percent-suffix {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  font-size: 0.85rem;
  pointer-events: none;
  margin-block-start: 2px;
}
.percent-wrap > .custom-input[hidden] ~ .percent-suffix {
  display: none;
}
.custom-color {
  width: 100%;
  min-height: 38px;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 2px;
  background: #1a1a24;
  cursor: pointer;
  margin-block-start: 4px;
}
.custom-color:focus { outline: none; border-color: #5588ff; }
.custom-color[hidden] { display: none; }

/* --- GIF Controls --- */
.gif-section {
  margin-block-end: 16px;
}
.gif-section[hidden] { display: none; }
.gif-bar {
  background: rgba(85, 136, 255, 0.08);
  border: 1px solid rgba(85, 136, 255, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.gif-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #88a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gif-frame-info {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: #ccc;
  background: #1a1a24;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #333;
  min-width: 60px;
  text-align: center;
}
.gif-speed {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
}
.gif-speed span { color: #aaa; font-size: 0.8rem; }
.gif-speed select { min-height: 32px !important; padding: 4px 28px 4px 10px !important; font-size: 0.8rem !important; }
.btn-small {
  padding: 6px 14px !important;
  font-size: 0.8rem !important;
  min-height: auto;
}

/* --- Output Section --- */
.output-section { margin-block-end: 24px; }
.preview-topbar {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 12px;
}
.output-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(90deg, #1c1c2a, #14141c);
  border: 1px solid #2a2a38;
  border-inline-start: 3px solid #5588ff;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 0.01em;
}
.output-header .live-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: #88a0c0;
}
.advanced-hint {
  margin-inline-start: 10px;
  font-size: 0.75rem;
  font-weight: 400;
  color: #6688bb;
  display: none;
}
.actions {
  display: flex;
  gap: 10px;
  margin-block-end: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}
.png-export {
  display: flex;
  align-items: stretch;
  border: 1px solid #333;
  border-radius: 10px;
  overflow: hidden;
  background: #1e1e2a;
}
.png-export .btn {
  border: none;
  border-radius: 0;
  border-inline-end: 1px solid #333;
  background: transparent;
}
.png-export .btn:hover:not(:disabled) {
  background: rgba(85, 136, 255, 0.1);
  color: #ddd;
}
.png-export select {
  background: transparent;
  color: #aaa;
  border: none;
  padding: 6px 28px 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M1.5 1.5l4.5 5 4.5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  font-family: inherit;
}
.png-export select:focus { outline: none; background-color: rgba(85, 136, 255, 0.08); }
@media (max-width: 640px) {
  .png-export { width: 100%; }
  .png-export .btn { flex: 1; }
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  font-family: inherit;
}
.btn:focus-visible {
  outline: 2px solid #5588ff;
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.35; cursor: default; transform: none; box-shadow: none; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, #2255cc, #1a44aa);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { transform: scale(1.03); box-shadow: 0 4px 16px rgba(34, 85, 204, 0.35); }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }

.btn-secondary {
  background: #1e1e2a;
  color: #aaa;
  border: 1px solid #333;
}
.btn-secondary:hover:not(:disabled) { border-color: #5588ff; color: #ddd; }
.btn-secondary:active:not(:disabled) { transform: scale(0.97); }

/* Status */
.status {
  font-size: 0.8rem;
  color: #aaa;
  margin-block-end: 10px;
  min-height: 1.2em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status.processing::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #5588ff;
  border-block-start-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Preview Zoom */
.preview-controls {
  display: flex;
  align-items: stretch;
}
.preview-controls[hidden] { display: none; }
.zoom-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #aaa;
  background: #14141c;
  border: 1px solid #252530;
  border-radius: 8px;
  padding: 6px 12px;
}
.zoom-label input[type="range"] {
  width: 140px;
  accent-color: #5588ff;
  cursor: pointer;
}
.zoom-value {
  font-family: 'Courier New', monospace;
  color: #ccc;
  min-width: 42px;
  text-align: right;
}

/* Preview */
.preview-viewport {
  position: relative;
  width: 100%;
}
.preview-wrap {
  width: 100%;
  /* Höhen-Cap, damit bei hohem Zoom auch vertikal gescrollt/gepannt werden
     kann. Im Zwei-Spalten-Layout wird das von einer spezifischeren Regel
     mit height:100% überschrieben. */
  max-height: 75vh;
  overflow: auto;
  text-align: center;
}
.preview-wrap.pannable { cursor: grab; }
.preview-wrap.panning  { cursor: grabbing; user-select: none; }
#preview {
  background: #0a0a0c;
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: calc(var(--preview-fit-px, 10px) * var(--preview-zoom, 1));
  line-height: 1.0;
  padding: 10px;
  border-radius: 10px;
  white-space: pre;
  display: inline-block;
  letter-spacing: 0;
  direction: ltr;
  unicode-bidi: isolate;
}
/* Schachbrett-Muster nur im Alpha-Transparent-Modus, damit man sieht,
   wo die leeren (durchsichtigen) Zellen liegen. */
#preview.show-transparency {
  background:
    linear-gradient(45deg, #151518 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, #151518 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #151518 75%) 0 0 / 16px 16px,
    linear-gradient(-45deg, transparent 75%, #151518 75%) 0 0 / 16px 16px,
    #0a0a0c;
}
#preview:empty { display: none; }

/* --- SEO Content Section --- */
.content-section {
  margin-block-start: 48px;
  border-block-start: 1px solid #1a1a22;
  padding-block-start: 40px;
}
/* Apple-esque Lesebreite-Helfer — wird auf direkte Prosa-Kinder der
   Content-Cards angewandt, damit Fliesstexte nicht mit der
   Sektion-Breite mitwachsen. Grids und Listen definieren ihre
   Breite selbst. */
.content-section .readable {
  max-width: 860px;
  margin-inline: auto;
}
.tip-box {
  background: rgba(85, 136, 255, 0.08);
  border-left: 4px solid #5588ff;
  border-radius: 6px;
  padding: 20px 24px;
  margin-block-end: 40px;
  max-width: 900px;
  margin-inline: auto;
}
.tip-box strong {
  display: block;
  color: #d0d0d0;
  font-size: 0.95rem;
  margin-block-end: 8px;
}
.tip-box p {
  color: #999;
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 0 0 6px 0;
}
.tip-box p:last-child { margin-block-end: 0; }
.tip-box a {
  color: #6699ff;
  font-weight: 600;
}
.example-wrap {
  margin-block-start: 12px;
  overflow-x: auto;
  border-radius: 8px;
}
.example-preview {
  background: #000;
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: clamp(3px, 1.2vw, 7px);
  line-height: 1.0;
  padding: 8px;
  border-radius: 8px;
  white-space: pre;
  display: inline-block;
  letter-spacing: 0;
  color: #ccc;
  direction: ltr;
  unicode-bidi: isolate;
}
.content-card {
  margin-block-end: 56px;
}
.content-card h2 {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  color: #f0f0f0;
  font-weight: 700;
  margin-block-end: 20px;
  letter-spacing: -0.02em;
  text-align: center;
}
/* Prosa unter der zentrierten Überschrift bleibt in Lese-Breite. */
.content-card > p {
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.75;
  margin: 0 auto 12px;
  max-width: 860px;
}
.howto-steps {
  list-style: decimal;
  padding-inline-start: 24px;
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.75;
  max-width: 860px;
  margin-inline: auto;
}
.howto-steps li {
  margin-block-end: 10px;
}
.howto-steps strong {
  color: #d0d0d0;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin-inline: auto;
}
.feature {
  background: #12121a;
  border: 1px solid #252530;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.feature strong {
  color: #d0d0d0;
  font-size: 0.88rem;
}
.feature span {
  color: #888;
  font-size: 0.78rem;
  line-height: 1.5;
}
.use-list {
  list-style: disc;
  padding-inline-start: 24px;
  color: #aaa;
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 860px;
  margin-inline: auto;
}
/* Use-Liste auf breiteren Viewports zweispaltig — nutzt den Platz. */
@media (min-width: 900px) {
  .use-list {
    columns: 2;
    column-gap: 40px;
    max-width: 1100px;
  }
  .use-list li { break-inside: avoid; }
}
.faq-list {
  max-width: 860px;
  margin-inline: auto;
}
/* Zwei Spalten ab ≥ 1100 px — liest sich auf breiten Monitoren viel
   ruhiger als eine 2000 px lange Liste. */
@media (min-width: 1100px) {
  .faq-list {
    columns: 2;
    column-gap: 20px;
    max-width: 1400px;
  }
}
.faq-item {
  background: #12121a;
  border: 1px solid #252530;
  border-radius: 10px;
  margin-block-end: 10px;
  overflow: hidden;
  break-inside: avoid;
}
.faq-item summary {
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ccc;
  user-select: none;
  list-style: none;
}
.faq-item summary::before {
  content: '▶';
  font-size: 0.8em;
  margin-inline-end: 10px;
  transition: transform 0.15s;
  display: inline-block;
  color: #666;
}
.faq-item[open] summary::before {
  transform: rotate(90deg);
}
.faq-item p {
  padding: 0 18px 14px;
  color: #999;
  font-size: 0.84rem;
  line-height: 1.7;
  margin: 0;
}
@media (max-width: 640px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* --- Footer --- */
footer {
  margin-block-start: auto;
  padding-block: 24px;
  text-align: center;
  font-size: 0.75rem;
  color: #666;
  border-block-start: 1px solid #1a1a22;
}
.footer-links {
  margin-block-start: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.footer-links a { color: #6699ff; }
.footer-sep { color: #444; }

/* --- Loading Spinner --- */
.loading .drop-icon::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #5588ff;
  border-block-start-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-inline-start: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Hidden --- */
canvas { display: none; }

/* --- Responsive --- */
@media (max-width: 820px) {
  .presets { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  header { padding-block: 16px 12px; }
  .header-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .presets { grid-template-columns: repeat(2, 1fr); }
  .controls fieldset { flex-direction: column; }
  .controls label { width: 100%; }
  .controls select { width: 100%; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; text-align: center; }
  .drop-zone { padding: 30px 16px; }
  .gif-bar { gap: 8px; }
}

@media (max-width: 380px) {
  .presets { grid-template-columns: 1fr 1fr; gap: 8px; }
  .preset { padding: 10px 6px; }
  .preset-desc { display: none; }
}

/* --- RTL --- */
[dir="rtl"] .advanced summary::before { content: '◀'; }
[dir="rtl"] .footer-links { direction: rtl; }
[dir="rtl"] .controls select,
[dir="rtl"] .lang-switch select {
  background-position: left 12px center;
  padding: 8px 12px 8px 36px;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

/* --- Two-Column Workspace (Desktop) --- */
@media (min-width: 1000px) {
  /* Alle Sektionen teilen denselben Rand (konsistente linke/rechte Kante)
     und nutzen die Viewport-Breite bis 2000 px aus. Lange Fließtexte
     bekommen eine eigene Lesebreite innen, damit sie nicht gestreckt
     wirken. */
  header, main, footer {
    max-width: 2000px;
    padding-inline: 32px;
  }
  /* Content-Sektion füllt die volle Workspace-Breite; innen sorgen
     die Einzel-Elemente selbst für Lesbarkeit (Prosa schmaler,
     Grids nutzen die Breite). Siehe ".content-card > *" weiter unten. */
  .workspace {
    display: grid;
    /* Settings-Spalte bleibt lesbar schmal (360-480 px), Preview-Spalte
       nimmt den gesamten Rest des Viewports ein. */
    grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
    grid-auto-rows: min-content;
    gap: 20px;
    align-items: start;
  }
  .workspace > .settings-section { grid-column: 1; grid-row: 1; margin-block-end: 0; }
  .workspace > .gif-section      { grid-column: 1; grid-row: 2; margin-block-end: 0; }
  .workspace > .output-section {
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    margin-block-end: 0;
  }
  .workspace > .output-section .preview-wrap {
    /* Direkter Viewport-basierter Höhen-Cap — robuster als die
       flex/height:100%-Kette, weil .output-section selbst nur ein
       max-height (kein definites height) hat und Prozent-Höhen
       darüber nicht aufgeloest werden. 220px = Platz für
       Output-Header, Actions, Status und Zoom-Controls. */
    max-height: calc(100vh - 220px);
  }
  .advanced-hint { display: inline; }
}
