:root {
  --night: #1c1b3a;
  --night-2: #2b2a54;
  --ink: #fbfbfe;
  --ink-soft: #c9c8e6;
  --sun: #ff7139;
  --rose: #ff4aa2;
  --violet: #9059ff;
  --sky: #45a1ff;
  --ok: #54ffbd;
  --err: #ff8a9b;
  --glow: linear-gradient(100deg, var(--sun), var(--rose) 38%, var(--violet) 70%, var(--sky));
  --radius: 20px;
  --font: "Metropolis", "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.55;
  background-color: var(--night);
  background-image:
    radial-gradient(60% 45% at 85% 105%, rgba(255, 113, 57, .55), transparent 70%),
    radial-gradient(60% 50% at 45% 110%, rgba(255, 74, 162, .5), transparent 70%),
    radial-gradient(60% 55% at 5% 100%, rgba(144, 89, 255, .55), transparent 70%),
    radial-gradient(70% 50% at 50% -10%, rgba(69, 161, 255, .22), transparent 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  animation: dawn 1.4s ease-out both;
}

/* Único momento animado: el amanecer al cargar */
@keyframes dawn {
  from { background-position: 0 40%, 0 40%, 0 40%, 0 0; opacity: .0; }
  to   { background-position: 0 0, 0 0, 0 0, 0 0; opacity: 1; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app {
  width: min(680px, 100% - 2rem);
  margin: 0 auto;
  padding: clamp(2rem, 8vh, 5rem) 0 2.5rem;
}

.head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.logo { flex: none; border-radius: 12px; box-shadow: 0 0 32px rgba(144, 89, 255, .55); }

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.02em;
  background: var(--glow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub { margin: .35rem 0 0; color: var(--ink-soft); font-size: .95rem; max-width: 52ch; }

.card {
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius);
  background: rgba(28, 27, 58, .72);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 30px 80px -20px rgba(10, 8, 40, .8);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

/* Zona de carga con borde degradado */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 1.25rem;
  border-radius: 14px;
  background:
    linear-gradient(var(--night-2), var(--night-2)) padding-box,
    var(--glow) border-box;
  border: 2px dashed transparent;
  cursor: pointer;
  text-align: center;
  transition: transform .15s ease, box-shadow .2s ease;
}

.dropzone:hover { box-shadow: 0 0 0 4px rgba(144, 89, 255, .2); }
.dropzone:focus-visible { outline: 3px solid var(--sky); outline-offset: 4px; }

.dropzone.is-over {
  transform: scale(1.015);
  box-shadow: 0 0 0 5px rgba(255, 74, 162, .3), 0 0 50px rgba(144, 89, 255, .45);
}

.dz-empty[hidden], .preview-wrap[hidden] { display: none; }

.dz-icon { width: 54px; height: 54px; color: var(--rose); margin-bottom: .5rem; }
.dz-title { margin: 0; font-size: 1.2rem; font-weight: 700; }
.dz-help { margin: .35rem auto 0; color: var(--ink-soft); font-size: .92rem; max-width: 36ch; }

.preview-wrap { width: 100%; display: grid; place-items: center; }
.preview-wrap img {
  max-width: 100%;
  max-height: 340px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.status {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  font-size: .95rem;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}
.status[hidden], .result[hidden], #open[hidden] { display: none; }
.status.is-error { color: var(--err); border-color: rgba(255, 138, 155, .4); background: rgba(255, 138, 155, .08); }

.result { margin-top: 1.25rem; }

.badge {
  display: inline-block;
  padding: .2rem .7rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--night);
  background: var(--glow);
}

.content {
  display: block;
  width: 100%;
  margin-top: .75rem;
  padding: .9rem 1rem;
  resize: vertical;
  min-height: 6rem;
  font: 400 .95rem/1.5 var(--mono);
  color: var(--ink);
  background: rgba(10, 8, 40, .55);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  overflow-wrap: anywhere;
}
.content:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .7rem 1.15rem;
  border-radius: 999px;
  font: 700 .95rem var(--font);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter .15s ease, background .15s ease;
}
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

.btn-primary { color: #fff; background: var(--glow); border: 0; }
.btn-primary:hover { filter: brightness(1.12); }

.btn-ghost { color: var(--ink); background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }

.foot { margin-top: 1.5rem; text-align: center; font-size: .85rem; color: var(--ink-soft); }
.foot p { margin: 0; }

@media (max-width: 480px) {
  .head { align-items: flex-start; }
  .actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .dropzone, .btn { transition: none; }
  .dropzone.is-over { transform: none; }
}
