:root {
  --bg: #0E0E0B;
  --surface: #141410;
  --surface-2: #1C1C18;
  --surface-3: #232320;
  --line: #2E2E29;
  --line-strong: #3b3b34;
  --text: #F5F5F0;
  --text-2: #c9c9c2;
  --muted: #8f8f86;
  --lime: #C8EF4D;
  --lime-hover: #d6f56f;
  --lime-ink: #0E0E0B;
  --lime-soft: rgba(200, 239, 77, .12);
  --warn: #f2c14e;
  --error: #ff7a6b;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow: 0 1px 0 rgba(255,255,240,.04) inset, 0 20px 40px -24px rgba(0,0,0,.8);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-head: 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --topbar-h: 64px;
  --z-top: 10;
  --z-toast: 20;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
/* Grano sutil para quitar lo plano del negro */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
h1, h2 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  font: 800 14px/1 var(--font-head); letter-spacing: .02em;
  background: var(--lime); color: var(--lime-ink);
  padding: 7px 9px; border-radius: 7px;
}
.logo-img { display: block; height: 30px; width: auto; }
.brand-name {
  font: 600 15px/1 var(--font-head); letter-spacing: -.01em; color: var(--text-2);
  padding-left: 12px; border-left: 1px solid var(--line-strong);
}
.login-card .logo-img { height: 38px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 12px 20px; font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  transition: transform .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary { background: var(--lime); color: var(--lime-ink); box-shadow: 0 8px 24px -12px rgba(200,239,77,.55); }
.btn.primary:hover:not(:disabled) { background: var(--lime-hover); }
.btn.outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.outline:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--lime); color: var(--lime); }
.btn.ghost { background: var(--surface-3); padding: 9px 16px; font-size: 13px; }
.btn.ghost:hover:not(:disabled) { background: var(--line-strong); }
.btn.sm { padding: 9px 16px; font-size: 13px; }
.btn.lg { padding: 15px 26px; font-size: 15px; }
.btn.icon { padding: 9px 11px; }

/* ---------- Acceso ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    linear-gradient(90deg, rgba(14,14,11,.96) 0%, rgba(14,14,11,.82) 45%, rgba(14,14,11,.35) 100%),
    url("presets/hero.jpg") center / cover no-repeat, var(--bg);
}
@media (min-width: 900px) {
  .login { place-items: center start; padding-left: max(6vw, 48px); }
}
.login-card {
  width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px;
  background: rgba(20,20,16,.78); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255,255,240,.06); border-radius: var(--r-xl); padding: 34px 30px 28px;
  box-shadow: var(--shadow);
}
.login-card .brand { margin-bottom: 14px; }
.login-card h1 { font: 800 30px/1.05 var(--font-head); letter-spacing: -.03em; margin: 0; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.login-card input {
  background: rgba(14,14,11,.7); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 13px 14px; font: 15px var(--font-body); transition: border-color .2s var(--ease);
}
.login-card input:focus { outline: none; border-color: var(--lime); }
.login-card .btn { margin-top: 4px; }
.login-card .lang-switch { align-self: center; margin-top: 4px; }
.login-error { color: var(--error); font-size: 13px; min-height: 1.2em; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; text-align: center; }

/* ---------- Barra superior ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: var(--z-top);
  background: rgba(14,14,11,.9); backdrop-filter: blur(12px);
}
.top-actions { display: flex; align-items: center; gap: 12px; }

.usage { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.usage-text { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.usage-bar i { display: block; height: 100%; width: 0; background: var(--lime); border-radius: inherit; transition: width .6s var(--ease); }
.usage.warn .usage-bar i { background: var(--warn); }
.usage.full .usage-bar i { background: var(--error); }
.usage.full .usage-text { color: var(--error); }

.lang-switch { display: inline-flex; background: var(--surface-3); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: 0; background: transparent; cursor: pointer; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--lime); color: var(--lime-ink); }

/* ---------- Espacio de trabajo ---------- */
.app {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: calc(100dvh - var(--topbar-h));
}
.panel {
  position: relative; display: flex; flex-direction: column; gap: 30px;
  padding: 24px 22px 0; overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--line); background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.step h2 {
  font: 600 14px/1 var(--font-head); letter-spacing: -.005em;
  margin: 0 0 14px; display: flex; align-items: center; gap: 10px; color: var(--text);
}
.num {
  font: 700 11px/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--lime);
  background: var(--lime-soft); padding: 4px 6px; border-radius: 6px;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  color: var(--muted); transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.dropzone.compact { flex-direction: row; justify-content: center; gap: 12px; padding: 16px; text-align: left; }
.dropzone.compact svg { flex: none; }
.dropzone.compact strong { display: block; font-size: 14px; }
.dropzone.compact small { display: block; }
.dropzone strong { color: var(--text); font-weight: 600; }
.dropzone small { font-size: 12px; }
.dropzone:hover, .dropzone.over { border-color: var(--lime); background: var(--lime-soft); color: var(--lime); }

/* Estilos con miniatura */
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preset {
  position: relative; padding: 0; cursor: pointer; overflow: hidden; text-align: left;
  aspect-ratio: 4 / 3; border: 0; border-radius: var(--r-md); background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.preset img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s var(--ease), filter .3s var(--ease); filter: saturate(.9) brightness(.92);
}
.preset::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 38%, rgba(10,10,8,.88) 100%);
}
.preset-label { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1; display: flex; flex-direction: column; }
.preset-label b { font-weight: 600; font-size: 13px; letter-spacing: -.01em; }
.preset-label span { display: none; }
.preset:hover img { transform: scale(1.05); filter: saturate(1) brightness(1); }
.preset:active { transform: scale(.98); }
.preset.active { box-shadow: inset 0 0 0 2px var(--lime), 0 10px 26px -14px rgba(200,239,77,.5); }
.preset.active img { filter: none; }
.preset.active b { color: var(--lime); }
.preset.active::before {
  content: ""; position: absolute; top: 8px; right: 8px; z-index: 1; width: 22px; height: 22px; border-radius: 50%;
  background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E0E0B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 13px no-repeat;
}

textarea {
  width: 100%; resize: vertical; min-height: 118px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: 12px 14px; font: 14px/1.55 var(--font-body);
  transition: border-color .2s var(--ease);
}
textarea:focus { outline: none; border-color: var(--lime); }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.hint::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); flex: none; }

/* Logo en matrícula */
.logo-box { display: flex; flex-direction: column; gap: 14px; }
.plate {
  display: flex; height: 60px; border-radius: 7px; overflow: hidden;
  background: #fafaf7; border: 2px solid #111; max-width: 290px;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.9);
}
.plate-eu {
  width: 26px; background: #1f45b0; color: #fff; display: grid; place-items: end center;
  font: 700 12px/1 var(--font-body); padding-bottom: 6px; flex: none;
}
.plate-body { flex: 1; display: grid; place-items: center; padding: 6px 10px; min-width: 0; }
.plate-body img { max-width: 100%; max-height: 44px; object-fit: contain; }
.plate-empty { font: 700 26px/1 var(--font-head); color: #c4c4bd; letter-spacing: .06em; }
.logo-rules { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12.5px; display: grid; gap: 5px; }
.logo-rules li { display: block; padding-left: 22px; text-indent: -22px; }
.logo-rules li::before { content: "—"; color: var(--line-strong); display: inline-block; width: 22px; text-indent: 0; }
.logo-rules b { color: var(--text-2); font-weight: 600; }
.logo-warn { font-size: 12.5px; color: var(--warn); padding: 10px 12px; border-radius: var(--r-sm); background: rgba(242,193,78,.08); }
.logo-warn:empty { display: none; }
.logo-warn.ok { color: var(--lime); background: var(--lime-soft); }
.logo-warn.err { color: var(--error); background: rgba(255,122,107,.08); }
.logo-actions { display: flex; gap: 8px; }
.logo-actions label.btn { cursor: pointer; }

/* Interruptor */
.switch { display: flex; align-items: center; gap: 12px; font-size: 14px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px;
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background .25s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-2); transition: transform .25s var(--ease), background .25s var(--ease);
}
.switch input:checked + .track { background: var(--lime); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--lime-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--lime); outline-offset: 2px; }
.switch:has(input:disabled) { opacity: .4; cursor: not-allowed; }

/* Acciones fijas al pie del panel */
.actions {
  position: sticky; bottom: 0; z-index: 2; margin: auto -22px 0; padding: 16px 22px 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  background: rgba(20,20,16,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

/* ---------- Lienzo ---------- */
.stage { display: flex; flex-direction: column; padding: 20px 22px 18px; gap: 14px; min-width: 0; min-height: 0; }
.canvas {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  border-radius: var(--r-xl); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease);
}
.canvas.over { box-shadow: inset 0 0 0 2px var(--lime); }

.empty {
  position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto; padding: clamp(24px, 4vw, 56px);
  background:
    linear-gradient(90deg, rgba(20,20,16,.97) 0%, rgba(20,20,16,.86) 42%, rgba(20,20,16,.2) 100%),
    linear-gradient(0deg, rgba(20,20,16,.9) 0%, transparent 35%),
    url("presets/hero.jpg") right center / cover no-repeat;
}
.empty-copy { align-self: center; max-width: 480px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--lime);
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 1.5px; background: var(--lime); }
.empty h1 { font: 800 clamp(36px, 4.6vw, 64px)/.98 var(--font-head); letter-spacing: -.035em; margin: 0; }
.empty h1 em { font-style: normal; color: var(--lime); display: block; }
.empty p { color: var(--text-2); margin: 0; max-width: 42ch; font-size: 15.5px; }
.empty .btn { margin-top: 8px; }
.empty-drop { color: var(--muted); font-size: 12.5px; }
.empty-steps {
  list-style: none; margin: 0; padding: 20px 0 0; border-top: 1px solid rgba(255,255,240,.08);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; max-width: 760px;
}
.empty-steps li { font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.empty-steps li span { font: 700 12px/1 var(--font-body); color: var(--lime); font-variant-numeric: tabular-nums; }

.compare {
  position: absolute; inset: 0; user-select: none; touch-action: none;
  cursor: ew-resize; background: #0a0a08;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.after-wrap { position: absolute; inset: 0; clip-path: inset(0 0 0 50%); }
.handle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: var(--lime); transform: translateX(-1px); box-shadow: 0 0 18px rgba(200,239,77,.5);
}
.handle span {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--lime); box-shadow: 0 6px 22px rgba(0,0,0,.45);
  transition: transform .2s var(--ease);
}
.compare:active .handle span { transform: translate(-50%, -50%) scale(1.1); }
.handle span::before {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E0E0B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l-6 6 6 6M15 6l6 6-6 6'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.compare.single .after-wrap, .compare.single .handle, .compare.single .tag { display: none; }
.compare.single { cursor: default; }
.tag {
  position: absolute; top: 16px; padding: 6px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(14,14,11,.7); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,240,.08);
}
.tag.left { left: 16px; }
.tag.right { right: 16px; color: var(--lime); }

/* Carga: barrido de escaneo sobre la foto */
.loading { position: absolute; inset: 0; display: grid; place-items: end center; padding-bottom: 28px; background: rgba(14,14,11,.35); overflow: hidden; }
.scan {
  position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(200,239,77,.18) 70%, rgba(200,239,77,.7) 100%);
  border-bottom: 2px solid var(--lime);
  animation: scan 2.2s var(--ease) infinite;
}
@keyframes scan { to { transform: translateY(433%); } }
.loading-pill {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(14,14,11,.8); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,240,.08);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }

.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 13px; }
.status.err { color: var(--error); }
.stage-actions { display: flex; gap: 8px; }

/* Tira de miniaturas */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.strip:empty { display: none; }
.thumb {
  position: relative; flex: 0 0 auto; width: 104px; aspect-ratio: 4/3;
  border-radius: var(--r-sm); overflow: hidden; cursor: pointer; padding: 0;
  background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.thumb:hover { transform: translateY(-2px); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { box-shadow: 0 0 0 2px var(--lime); }
.thumb .dot {
  position: absolute; bottom: 6px; left: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 2px rgba(14,14,11,.9);
}
.thumb[data-state="done"] .dot { background: var(--lime); }
.thumb[data-state="working"] .dot { background: #fff; animation: pulse 1s infinite; }
.thumb[data-state="error"] .dot { background: var(--error); }
.thumb .remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(14,14,11,.85); cursor: pointer; font-size: 11px; line-height: 1;
  opacity: 0; transition: opacity .2s var(--ease);
}
.thumb:hover .remove, .thumb:focus-within .remove { opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast); transform: translate(-50%, 16px);
  background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  padding: 12px 18px; border-radius: var(--r-md); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease); max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--error); color: var(--error); }

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

/* ---------- Tablet y móvil: una columna, la foto arriba ---------- */
@media (max-width: 1100px) {
  .usage { min-width: 0; }
  .usage-bar { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .panel { order: 2; overflow: visible; border-right: 0; border-top: 1px solid var(--line); padding: 22px 16px 0; }
  .stage { order: 1; padding: 14px 16px 16px; }
  .canvas { flex: none; aspect-ratio: 4 / 3; }
  .empty { grid-template-rows: 1fr; padding: 22px; background:
    linear-gradient(0deg, rgba(20,20,16,.97) 20%, rgba(20,20,16,.55) 100%), url("presets/hero.jpg") center / cover no-repeat; }
  .empty-copy { align-self: end; gap: 10px; }
  .empty h1 { font-size: clamp(28px, 8vw, 40px); }
  .empty p, .empty-drop, .empty-steps { display: none; }
  .empty .btn { margin-top: 4px; }
  .actions { margin: 0 -16px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(20,20,16,.95); backdrop-filter: blur(12px); border-top-color: var(--line); }
  .topbar { padding: 0 16px; }
  .top-actions { gap: 8px; }
  .usage, #downloadAll { display: none; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}

/* Fondos propios */
.own-bg { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.own-bg-title { margin: 0; font: 600 13.5px/1.3 var(--font-head); }
.own-bg-sub { margin: 4px 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.bgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.bg-item, .bg-add {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; cursor: pointer; padding: 0;
  border: 0; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.bg-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-item.active { box-shadow: inset 0 0 0 2px var(--lime), 0 10px 26px -14px rgba(200,239,77,.5); }
.bg-item.active::before {
  content: ""; position: absolute; top: 8px; left: 8px; z-index: 1; width: 22px; height: 22px; border-radius: 50%;
  background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E0E0B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.bg-del { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(14,14,11,.85); color: var(--text); font-size: 11px; opacity: 0; transition: opacity .2s; }
.bg-item:hover .bg-del, .bg-item:focus-visible .bg-del { opacity: 1; }
.bg-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); border: 1.5px dashed var(--line-strong); box-shadow: none; background: transparent; }
.bg-add span { font: 400 26px/1 var(--font-body); color: var(--lime); }
.bg-add small { font-size: 12px; }
.bg-add:hover { border-color: var(--lime); color: var(--lime); }
@media (hover: none) { .bg-del { opacity: 1; } }

/* Fondo propio: solo plan Pro */
.pro-badge { display: inline-block; margin-left: 6px; padding: 3px 6px; border-radius: 5px; background: var(--lime); color: var(--lime-ink); font: 800 10px/1 var(--font-body); letter-spacing: .06em; vertical-align: 2px; }
.bg-locked { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--lime-soft); border: 1px solid rgba(200,239,77,.25); }
.bg-locked p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.bg-locked .btn { text-decoration: none; }
.own-bg.is-locked .own-bg-sub { display: none; }

/* Formato de salida */
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fmt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--r-md); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s var(--ease);
}
.fmt:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.fmt.active { box-shadow: inset 0 0 0 2px var(--lime); }
.fmt-shape { display: block; height: 22px; max-width: 34px; border: 1.5px solid var(--muted); border-radius: 3px; margin-bottom: 6px; }
.fmt-shape.any { width: 26px; border-style: dashed; }
.fmt.active .fmt-shape { border-color: var(--lime); background: var(--lime-soft); }
.fmt b { font-size: 12.5px; font-weight: 600; }
.fmt b em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 2px; }
.fmt span { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.fmt.active b { color: var(--lime); }
#formatHint:empty { display: none; }
/* Resultado en otro formato: se muestra solo el resultado (no se puede comparar píxel a píxel) */
.compare.reformat .after-wrap { clip-path: none !important; }
.compare.reformat .handle, .compare.reformat .tag.left { display: none; }
.compare.reformat .img-before, .compare.reformat #imgBefore { visibility: hidden; }
.compare.reformat { cursor: default; }
@media (max-width: 420px) { .formats { grid-template-columns: repeat(2, 1fr); } }

/* Fondo limpio: imagen panorámica con el coche a la derecha y la zona del texto oscura */
.empty {
  background:
    var(--surface);
}
/* La foto va en una capa aparte con los bordes difuminados para que se funda con el fondo */
.empty::before {
  content: ""; position: absolute; right: 0; top: 46%; transform: translateY(-50%);
  width: 118%; aspect-ratio: 2400 / 1029; pointer-events: none;
  background: url("/img/final.jpg") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 34%, #000 60%), linear-gradient(180deg, transparent 0%, #000 22%, #000 76%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 34%, #000 60%), linear-gradient(180deg, transparent 0%, #000 22%, #000 76%, transparent 100%);
          mask-composite: intersect;
}
.empty > * { position: relative; z-index: 1; }
.login {
  background:
    linear-gradient(90deg, rgba(14,14,11,.97) 0%, rgba(14,14,11,.7) 42%, rgba(14,14,11,0) 70%),
    url("/img/final.jpg") 75% 55% / cover no-repeat, var(--bg);
}
@media (max-width: 900px) {
  .empty { background: linear-gradient(0deg, rgba(20,20,16,.97) 25%, rgba(20,20,16,.35) 100%), url("/img/final.jpg") 72% 55% / cover no-repeat; }
}
