  body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 50% -200px, #3b3f7a, #0b0b14);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #eaeaf0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .card {
    width: 95%;
    max-width: 900px;
    background: linear-gradient(135deg, #1a1d3a, #14162b);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    padding: 28px;
  }

  h1 {
    margin-top: 0;
    font-size: 2rem;
    color: #b7a6ff;
  }

  textarea {
    width: 100%;
    box-sizing: border-box;
    border-radius: 14px;
    border: none;
    padding: 14px;
    font-size: 1rem;
    margin-top: 12px;
    resize: vertical;
  }

  button {
    margin-top: 14px;
    padding: 14px 24px;
    border-radius: 999px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
  }

  #cleanBtn {
    background: linear-gradient(135deg, #7b6cff, #9b8cff);
    color: #fff;
  }

  #copyBtn {
    background: #2b2f55;
    color: #eaeaf0;
  }

/* Export buttons */
#exportTxt,
#exportMd,
#exportPdf,
#exportHtml,
#exportRtf,
#exportJson,
#exportDocx {
  background: #1f2347;
  color: #eaeaf0;
  margin: 8px 6px 0 0;
  padding: 12px 18px;
  font-size: 0.9rem;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.1s ease;
}

#exportTxt:hover,
#exportMd:hover,
#exportPdf:hover,
#exportHtml:hover,
#exportRtf:hover,
#exportJson:hover,
#exportDocx:hover {
  background: #2b2f55;
  transform: translateY(-1px);
}

/* ===============================
   WELCOME MODAL — SINGLE SOURCE
   =============================== */

.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 15, 0.75);
  backdrop-filter: blur(10px);
  z-index: 10000;

  display: flex;
  align-items: flex-start;
  justify-content: center;

  padding: 16px;
  overflow-y: auto;

  opacity: 0;
  pointer-events: none;
}

.welcome-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.welcome-card {
  width: 100%;
  max-width: 720px;

  background: linear-gradient(135deg, #1a1d3a, #14162b);
  border-radius: 24px;

  display: flex;
  margin: auto 0;
}

.welcome-left {
  flex: 0 0 38%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.welcome-right {
  flex: 1;
  padding: 24px;
  color: #eaeaf0;

  display: flex;
  flex-direction: column;
  justify-content: center;
}

.welcome-logo {
  width: 140px;
  height: auto;
}

.welcome-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: #d7cfff;
  cursor: pointer;
}

/* MOBILE */
@media (max-width: 700px) {
  .welcome-card {
    flex-direction: column;
    max-width: 420px;
  }

  .welcome-left {
    padding: 16px 0;
  }

  .welcome-right {
    padding: 20px;
    justify-content: flex-start;
  }
}

.welcome-links a,
.welcome-donate {
  color: #9b8cff;
  text-decoration: underline;
  font-weight: 600;
}

.welcome-links a:hover,
.welcome-donate:hover {
  color: #ffffff;
}

.welcome-links a:hover,
.welcome-donate:hover {
  color: #ffffff;
}

.welcome-primary {
  margin-top: 18px;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;

  background: linear-gradient(135deg, #7b6cff, #9b8cff);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;

  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.welcome-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(123,108,255,0.35);
}

/* ===== HEADER CENTRADO (LOGO + TEXTO) ===== */

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: 100%;
  margin: 0 auto 20px auto;
  text-align: center;
}

.header-logo {
  display: block;
  margin: 0 auto;
}

#mainTitle {
  margin: 0;
  text-align: center;
}

/* ===== Donaciones arriba a la derecha ===== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.donate-top {
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb703, #ffd166);
  color: #1a1a1a;
  font-weight: 600;
  white-space: nowrap;
}

.donate-top:hover {
  opacity: 0.9;
}

@media (max-width: 480px) {
  .donate-top {
    font-size: 0.8rem;
    padding: 6px 10px;
  }
}

/* ===== HEADER FIX DEFINITIVO (iOS SAFE + DONACIONES) ===== */

.header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding-top: env(safe-area-inset-top);
  margin-bottom: 20px;
}

.header-logo {
  max-width: 120px;
  height: auto;
}

#mainTitle {
  margin-top: 8px;
  text-align: center;
}

/* Donaciones arriba a la derecha */
.donate-top {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;

  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb703, #ffd166);
  color: #1a1a1a;
  font-weight: 700;
  white-space: nowrap;
  z-index: 10;
}

/* iPhone pequeños */
@media (max-width: 480px) {
  .header-logo {
    max-width: 96px;
  }

  .donate-top {
    font-size: 0.75rem;
    padding: 6px 10px;
  }
}