/* Combinar fotos — hoja de estilos */

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

[hidden] { display: none !important; }

:root {
  color-scheme: light dark;
  --bg: #f4f5fa;
  --bg-grad:
    radial-gradient(1100px 560px at 12% -12%, #e7e8ff 0%, transparent 62%),
    radial-gradient(900px 480px at 102% -4%, #e2f1ff 0%, transparent 58%);
  --card: #ffffff;
  --card-2: #f7f8fc;
  --ink: #0e1424;
  --ink-2: #3b4559;
  --muted: #6b7488;
  --line: #e3e7f0;
  --line-strong: #cfd6e4;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ink: #ffffff;
  --danger: #d92d20;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 14px 34px -20px rgba(16, 24, 40, .40);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e16;
    --bg-grad:
      radial-gradient(1100px 560px at 12% -12%, rgba(79, 70, 229, .22) 0%, transparent 62%),
      radial-gradient(900px 480px at 102% -4%, rgba(14, 165, 233, .16) 0%, transparent 58%);
    --card: #121725;
    --card-2: #0e1320;
    --ink: #eef1f8;
    --ink-2: #c3cadb;
    --muted: #95a1b8;
    --line: #222b3d;
    --line-strong: #303b52;
    --accent: #7c7bff;
    --accent-hover: #8f8eff;
    --accent-soft: #1b2040;
    --accent-ink: #0b0e16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 22px 44px -26px rgba(0, 0, 0, .9);
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: min(1080px, 100% - 32px);
  margin-inline: auto;
}

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

/* ---------- Encabezado ---------- */

.hero { padding: 26px 0 2px; }

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

.logo {
  display: inline-flex;
  padding: 7px 9px 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.logo img {
  display: block;
  height: 76px;
  width: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 640;
  letter-spacing: .01em;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 7px 13px 7px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.brand svg { width: 17px; height: 17px; color: var(--accent); }

.hero h1 {
  margin: 20px 0 12px;
  font-size: clamp(29px, 4.8vw, 44px);
  line-height: 1.04;
  letter-spacing: -.032em;
  font-weight: 760;
}

.hero h1 .grad {
  background: linear-gradient(94deg, #4f46e5 0%, #0ea5e9 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0 0 24px;
  max-width: 60ch;
  color: var(--muted);
  font-size: clamp(14.5px, 1.6vw, 16px);
  line-height: 1.6;
}

/* ---------- Estructura ---------- */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 26px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* ---------- Selectores de foto ---------- */

.slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.slot {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 330px;
  border-radius: var(--radius-sm);
}

.drop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-strong);
  background: var(--card-2);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.drop:hover { border-color: var(--accent); background: var(--accent-soft); }

.slot:focus-within .drop {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

.slot.dragover .drop {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.placeholder svg { width: 30px; height: 30px; margin-bottom: 4px; opacity: .75; }
.placeholder strong { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.placeholder small { font-size: 11.5px; }

.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  pointer-events: none;
}

.slot.has-image .drop {
  border-style: solid;
  border-color: var(--line);
  background: #ffffff;
}

.tag {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(9, 12, 24, .62);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.slot:not(.has-image) .tag {
  background: var(--accent-soft);
  color: var(--accent);
}

.remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  color: #fff;
  background: rgba(9, 12, 24, .62);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background .15s ease;
}

.remove:hover { background: var(--danger); }

.meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 24px 10px 9px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-align: center;
  background: linear-gradient(to top, rgba(3, 7, 18, .74), rgba(3, 7, 18, 0));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  pointer-events: none;
}

.slot.loading .drop::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2.5px solid rgba(79, 70, 229, .25);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Botones ---------- */

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
}

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 620;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, opacity .15s ease;
}

.btn svg { width: 17px; height: 17px; flex: none; }

.btn:active:not(:disabled) { transform: translateY(1px) scale(.996); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn.ghost {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--card); }

.btn.small { padding: 7px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.small svg { width: 15px; height: 15px; }

.paste-hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Ajustes ---------- */

.settings {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.settings summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px 6px;
  font-size: 13px;
  font-weight: 640;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

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

.settings summary .chev {
  width: 16px;
  height: 16px;
  transition: transform .18s ease;
}

.settings[open] summary .chev { transform: rotate(180deg); }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 6px 2px 4px;
}

.field { min-width: 0; }

.field > label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: .012em;
  color: var(--muted);
}

.field output {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

select,
input[type="color"],
input[type="range"] {
  width: 100%;
  font: inherit;
}

select {
  appearance: none;
  padding: 9px 30px 9px 11px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background-color: var(--card-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238892a8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"] {
  height: 24px;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="color"] {
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card-2);
  cursor: pointer;
}

/* ---------- Resultado ---------- */

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.result-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 660;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
}

.dims:empty { display: none; }

.dims {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}

.canvas-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 232px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-2);
  overflow: hidden;
}

#preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(56vh, 540px);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 34px -22px rgba(0, 0, 0, .65);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 42px 18px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 34ch;
}

.empty-state svg { width: 34px; height: 34px; opacity: .6; }

.actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.actions .btn.primary {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  border-radius: 13px;
}

.hint {
  margin: 9px 2px 0;
  font-size: 11.8px;
  line-height: 1.5;
  color: var(--muted);
}

#privacyHint { margin-top: 7px; }

/* ---------- Pie ---------- */

.foot {
  margin-top: auto;
  padding: 18px 0 26px;
  font-size: 12px;
  color: var(--muted);
}

.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  text-align: center;
}

.foot .dot { opacity: .5; }

/* ---------- Aviso flotante ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  transform: translate(-50%, 16px);
  max-width: min(92vw, 440px);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.4;
  text-align: center;
  color: #f8fafc;
  background: rgba(15, 20, 34, .94);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b42318; }

/* ---------- Adaptación a pantallas chicas ---------- */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; gap: 14px; }
  .hero { padding-top: 18px; }
  .paste-hint { display: none; }
  .canvas-box { min-height: 190px; }
  #preview { max-height: 48vh; }
  .topbar { gap: 10px; }
  .logo { padding: 5px 7px; border-radius: 12px; }
  .logo img { height: 58px; }
  .brand { font-size: 12.5px; padding: 6px 11px 6px 9px; }
}

@media (max-width: 380px) {
  .wrap { width: min(1080px, 100% - 22px); }
  .card { padding: 14px; }
  .fields { grid-template-columns: 1fr; }
  .slot { max-height: 240px; }
  .logo img { height: 48px; }
  .brand { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
