/* ============================================================
   Cartas con diseño y editor de libros (estilo Canva)
   ============================================================ */

/* ---------- Lienzo de 600 × 800 que se escala a su marco ---------- */
.lienzo-marco { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; --k: 1; }
.lienzo { position: absolute; top: 0; left: 0; width: 600px; height: 800px; transform: scale(var(--k)); transform-origin: 0 0; overflow: hidden; }

/* ---------- Páginas con diseño libre ---------- */
.pagina-diseno { background-color: #FFFDF8; }
.el { position: absolute; display: block; color: inherit; text-decoration: none; transform-origin: center; }
.el-in { width: 100%; height: 100%; }
.el-foto { position: relative; width: 100%; height: 100%; overflow: hidden; box-sizing: border-box; }
.el img { width: 100%; height: 100%; display: block; margin: 0; max-height: none; border-radius: 0; pointer-events: none; user-select: none; }
.el-texto { width: 100%; min-height: 100%; box-sizing: border-box; overflow-wrap: break-word; outline: none; }
.el-texto p, .el-texto h2, .el-texto h3, .el-texto ul, .el-texto ol, .el-texto blockquote { margin: 0; }
.el-texto ul, .el-texto ol { padding-left: 1.3em; text-align: left; }
.el-texto h2, .el-texto h3 { font-family: inherit; color: inherit; font-size: 1.25em; }
.el-texto h2 { font-size: 1.5em; }
.el-texto blockquote { padding-left: .8em; border-left: 3px solid #C9A46A; font-style: italic; }
.el-texto a { color: inherit; text-decoration: underline; }
.el-texto img { width: auto; height: auto; max-width: 100%; display: inline-block; }
.el-texto hr, .carta-texto hr { border: none; border-top: 1.5px solid currentColor; opacity: .35; margin: .6em 0; }
.el-curva { width: 100%; height: 100%; overflow: visible; display: block; }

/* Efectos de texto de la cinta (también en las cartas) */
.ef-sombra { text-shadow: 2px 2px 4px rgba(0, 0, 0, .35); }
.ef-relieve { text-shadow: 0 1px 0 #fff, 0 2px 3px rgba(0, 0, 0, .3); }
.ef-contorno { -webkit-text-stroke: .035em currentColor; -webkit-text-fill-color: transparent; }
.ef-neon { text-shadow: 0 0 .12em #fff, 0 0 .3em currentColor, 0 0 .7em currentColor; }
.ef-brillo { text-shadow: 0 0 .45em rgba(247, 220, 148, .95); }
.ef-degradado { background: linear-gradient(90deg, #8C4A62, #C9A46A); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
mark { background: #FFF3A3; color: inherit; padding: 0 .1em; }
.ver-marcas p::after, .ver-marcas h2::after, .ver-marcas h3::after, .ver-marcas li::after { content: '¶'; color: rgba(140, 74, 98, .45); font-family: Arial, sans-serif; font-weight: 400; font-style: normal; margin-left: .15em; }
.ver-marcas br::after { content: '↵'; }

/* Papel de carta usado como fondo de una página con diseño */
.pagina-diseno.con-papel { background: var(--c-fondo); }
.pagina-diseno.con-papel .carta-deco { z-index: 0; }
.el-figura, .el svg { width: 100%; height: 100%; display: block; }
.el-sticker { width: 100%; height: 100%; display: grid; place-items: center; line-height: 1; user-select: none; }
.el-vacia { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; gap: .3rem; border: 2px dashed rgba(140, 74, 98, .35); border-radius: 10px; background: rgba(255, 255, 255, .55); color: #8C4A62; font-size: 15px; line-height: 1.3; }
.el-vacia span { font-size: 40px; }
.el.marco-polaroid { background: #fff; padding: 14px 14px 52px; box-shadow: 0 10px 24px -8px rgba(60, 30, 40, .35); }
.el.marco-sombra .el-foto { box-shadow: 0 14px 30px -10px rgba(60, 30, 40, .45); overflow: hidden; }
.el.marco-circulo .el-foto { border-radius: 50% !important; }
a.el:hover { filter: brightness(1.04); }

/* ---------- Hojas del libro con diseño ---------- */
.hoja.hoja-diseno { height: auto; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; }
.hoja.hoja-diseno .lienzo-marco { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.hoja.hoja-diseno .hoja-num { bottom: .5rem; z-index: 2; color: rgba(90, 60, 70, .55); font-size: .8rem; }
.hoja-botones { position: absolute; top: .5rem; right: .5rem; z-index: 3; display: flex; gap: .3rem; }
.hoja-botones .btn-editar, .hoja-botones .btn-borrar { margin: 0; background: rgba(255, 253, 248, .92); border-radius: 999px; padding: .2rem .7rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }

/* ---------- Cartas: tipografía compartida ---------- */
.carta-texto { font-family: var(--carta-fuente, var(--serif)); font-size: 20px; line-height: 1.65; color: var(--c-tinta, var(--tinta)); overflow-wrap: break-word; }
.carta-texto p { margin: 0 0 .75em; }
.carta-texto h2 { font-family: inherit; font-size: 1.6em; font-weight: 600; color: var(--c-titulo, var(--vino)); margin: .2em 0 .5em; line-height: 1.2; }
.carta-texto h3 { font-family: inherit; font-size: 1.25em; font-weight: 600; color: var(--c-titulo, var(--vino)); margin: .2em 0 .45em; line-height: 1.25; }
.carta-texto blockquote { margin: 0 0 .9em; padding: .2em 0 .2em 1em; border-left: 3px solid var(--c-acento, var(--dorado)); font-style: italic; color: var(--c-titulo, var(--vino)); }
.carta-texto ul, .carta-texto ol { margin: 0 0 .8em; padding-left: 1.4em; }
.carta-texto a { color: var(--c-acento, var(--vino)); }
.carta-texto img { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; margin: .3em auto .9em; border-radius: 10px; box-shadow: 0 8px 20px -10px rgba(60, 30, 40, .4); }
.carta-cabeza { margin-bottom: 1.1em; }
.carta-fecha { font-family: var(--sans); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--c-acento, var(--dorado)); }
.carta-titulo { font-family: inherit; font-size: 40px; font-weight: 600; line-height: 1.15; color: var(--c-titulo, var(--vino)); margin: .15em 0 .3em; }
.carta-cabeza .p-frutos { margin: .4em 0 0; }
.carta-texto img.carta-portada { max-height: 300px; width: 100%; object-fit: cover; margin: 0 0 1.1em; }
.carta-firma { font-family: var(--mano); font-size: 32px; color: var(--c-titulo, var(--vino)); text-align: right; margin-top: .6em; }

/* ---------- Cartas: hoja de 600 × 800 ---------- */
.carta-hoja { background: var(--c-fondo, #FFFDF8); }
.carta-cuerpo { position: absolute; top: 72px; left: 64px; right: 64px; bottom: 72px; overflow: hidden; }
.carta-num { position: absolute; bottom: 26px; left: 0; right: 0; text-align: center; font-family: var(--serif); font-size: 15px; color: var(--c-acento, var(--suave)); }
.carta-deco { position: absolute; inset: 0; pointer-events: none; }
.carta-deco::before, .carta-deco::after { content: ''; position: absolute; }
.carta-medidor { position: fixed; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }
.carta-medidor .lienzo-marco { width: 600px; }
.carta-medidor .lienzo { transform: none; }
.carta-hojas { display: grid; gap: 1.2rem; max-width: 600px; margin: 0 auto; }
.carta-hojas .lienzo-marco { border-radius: 10px; box-shadow: var(--sombra); }
.carta-acciones { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .8rem; }
.carta-acciones .btn-editar, .carta-acciones .btn-borrar { margin: 0; }

/* ---------- Plantillas de papel ---------- */
.plantilla-clasica { --c-fondo: #FFFDF8; --c-tinta: #3B2A2E; --c-titulo: #8C4A62; --c-acento: #C9A46A; }
.plantilla-clasica .carta-deco::before { inset: 26px; border: 1px solid rgba(201, 164, 106, .7); border-radius: 4px; }
.plantilla-clasica .carta-deco::after { inset: 32px; border: 1px solid rgba(201, 164, 106, .35); border-radius: 2px; }

.plantilla-rosa { --c-fondo: linear-gradient(180deg, #FFF5F4, #F8E1E1); --c-tinta: #4A2C34; --c-titulo: #9C4A64; --c-acento: #D08C9F; }
.plantilla-rosa .carta-deco::before { inset: 22px; border: 2px dashed rgba(208, 140, 159, .55); border-radius: 22px; }
.plantilla-rosa .carta-deco::after { content: '♡   ♡   ♡'; top: 30px; left: 0; right: 0; text-align: center; color: #D08C9F; font-size: 16px; letter-spacing: 4px; }

.plantilla-lavanda { --c-fondo: linear-gradient(170deg, #FBF8FF, #ECE3F7); --c-tinta: #3A2E48; --c-titulo: #7A4E8C; --c-acento: #A98BC4; }
.plantilla-lavanda .carta-deco::before { top: -24px; right: -26px; width: 190px; height: 220px; background: url('../imagenes/decoracion/orquidea-rama.svg') center / contain no-repeat; opacity: .5; }
.plantilla-lavanda .carta-deco::after { bottom: -26px; left: -24px; width: 160px; height: 180px; background: url('../imagenes/decoracion/orquidea-rama.svg') center / contain no-repeat; transform: rotate(180deg); opacity: .6; }

.plantilla-cielo { --c-fondo: linear-gradient(180deg, #E6F1FB, #FFFFFF 70%); --c-tinta: #2C3A4A; --c-titulo: #3F6A93; --c-acento: #8DB3D6; }
.plantilla-cielo .carta-deco::before { top: 18px; left: 40px; width: 180px; height: 50px; border-radius: 50px; background: #fff; box-shadow: 60px -16px 0 6px #fff, 120px 4px 0 -4px #fff; opacity: .9; }
.plantilla-cielo .carta-deco::after { top: 34px; right: 46px; width: 120px; height: 36px; border-radius: 40px; background: #fff; box-shadow: -40px -12px 0 4px #fff; opacity: .8; }

.plantilla-menta { --c-fondo: linear-gradient(170deg, #F4FBF7, #E2F2E9); --c-tinta: #2D3B33; --c-titulo: #4F7B63; --c-acento: #8DBFA2; }
.plantilla-menta .carta-deco::before { inset: 0; border: 18px solid transparent; border-image: repeating-linear-gradient(45deg, rgba(141, 191, 162, .45) 0 6px, transparent 6px 14px) 18; }
.plantilla-menta .carta-deco::after { content: '❦'; bottom: 26px; right: 34px; font-size: 30px; color: #8DBFA2; }

.plantilla-pergamino { --c-fondo: radial-gradient(ellipse at center, #F8EEDB 40%, #E8D3AE); --c-tinta: #4A3426; --c-titulo: #7A4E2D; --c-acento: #A7804F; }
.plantilla-pergamino .carta-deco::before { inset: 0; box-shadow: inset 0 0 70px rgba(122, 78, 45, .28); }
.plantilla-pergamino .carta-deco::after { content: '✦'; top: 28px; left: 0; right: 0; text-align: center; color: #A7804F; font-size: 18px; }

.plantilla-noche { --c-fondo: url('../imagenes/decoracion/noche.svg') center / cover, linear-gradient(180deg, #1F2340, #3A3F6B); --c-tinta: #F6E7D0; --c-titulo: #F7DC94; --c-acento: #F7DC94; }
.plantilla-noche .carta-texto img { box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }

/* ---------- Editor de cartas ---------- */
.ce { display: grid; gap: .7rem; }
.ce-disenos { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .1rem .5rem; scrollbar-width: thin; }
.ce-chip { flex: none; display: grid; gap: .3rem; justify-items: center; width: 82px; padding: 0; border: none; background: none; cursor: pointer; color: var(--suave); }
.ce-chip small { font-size: .68rem; line-height: 1.2; text-align: center; }
.ce-muestra { position: relative; display: block; width: 66px; height: 88px; border-radius: 8px; overflow: hidden; background: var(--c-fondo); box-shadow: 0 0 0 1px var(--linea); }
.ce-muestra .carta-deco { transform: scale(.11); transform-origin: 0 0; width: 600px; height: 800px; }
.ce-chip[aria-checked="true"] .ce-muestra { box-shadow: 0 0 0 3px var(--vino); }
.ce-chip[aria-checked="true"] small { color: var(--vino); font-weight: 500; }
.ce-fila { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ce-fuente { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--suave); }
.ce-fuente select { width: auto; margin: 0; padding: .45rem .6rem; }
.ce-fila .btn { padding: .5rem 1rem; font-size: .88rem; }
.ce-cinta { position: sticky; top: -2rem; z-index: 3; }
.ce-barra { position: sticky; top: -2rem; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; padding: .35rem; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; box-shadow: 0 6px 14px -10px rgba(90, 31, 41, .35); }
.ce-barra button, .ce-img { min-width: 34px; height: 34px; padding: 0 .5rem; border: none; border-radius: 8px; background: none; color: var(--tinta); cursor: pointer; font-size: .9rem; display: inline-grid; place-items: center; }
.ce-barra button:hover, .ce-img:hover { background: var(--rosa); color: var(--vino); }
.ce-sep { width: 1px; height: 22px; background: var(--linea); margin: 0 .15rem; }
.ce-color { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.ce-hoja { position: relative; border-radius: 12px; background: var(--c-fondo, #FFFDF8); box-shadow: 0 0 0 1px var(--linea); overflow: hidden; }
.ce-hoja .carta-deco { opacity: .8; }
.ce-area { position: relative; min-height: 340px; max-height: 60vh; overflow-y: auto; padding: 2.4rem 2.2rem; outline: none; }
.ce-area:focus { box-shadow: inset 0 0 0 2px rgba(140, 74, 98, .25); }
.ce-area img { max-height: 280px; }
.ce-previa { border-top: 1px dashed var(--linea); padding-top: .8rem; }
.ce-previa .carta-hojas { max-width: 420px; margin: 0 auto; }
.campo-carta > span { display: block; font-size: .9rem; margin-bottom: .3rem; }
.modal-contenido.ancho { width: min(820px, 100%); }
@media (max-width: 520px) {
  .ce-area { padding: 1.6rem 1.2rem; }
  .modal-contenido.ancho { padding: 2rem .9rem; }
}

/* ============================================================
   Editor de libros
   ============================================================ */
body.editando-libro { overflow: hidden; }
.ed {
  --f-playfair: 'Playfair Display', Georgia, serif; --f-serif: 'Cormorant Garamond', Georgia, serif;
  --f-mano: 'Dancing Script', cursive; --f-vibes: 'Great Vibes', cursive;
  position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: #EEE6DF; color: var(--tinta); font-family: var(--sans); font-size: .9rem;
}
.ed-barra { display: flex; align-items: center; gap: .6rem; padding: .5rem 16px; background: var(--papel); border-bottom: 1px solid var(--linea); }
.ed-titulo { font-family: var(--serif); font-size: 1.25rem; color: var(--vino); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ed-estado { color: var(--suave); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ed-grupo { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.ed-btn { border: none; background: none; color: var(--tinta); padding: .4rem .65rem; border-radius: 8px; cursor: pointer; white-space: nowrap; min-height: 34px; }
.ed-btn:hover:not(:disabled) { background: var(--rosa); color: var(--vino); }
.ed-btn.activo { background: var(--vino); color: var(--papel); }
.ed-btn:disabled { opacity: .35; cursor: default; }
.ed-barra .btn { padding: .5rem 1.1rem; }
.ed-zoom { min-width: 56px; font-variant-numeric: tabular-nums; }

.ed-cuerpo { display: grid; grid-template-columns: 78px 290px minmax(0, 1fr); min-height: 0; }
.ed.sin-panel .ed-cuerpo { grid-template-columns: 78px minmax(0, 1fr); }
.ed-herramientas { display: flex; flex-direction: column; gap: .2rem; padding: .5rem .35rem; background: #3F2A33; overflow-y: auto; }
.ed-herramientas button { display: grid; justify-items: center; gap: .15rem; padding: .55rem .2rem; border: none; border-radius: 10px; background: none; color: #EADBDF; cursor: pointer; font-size: .7rem; }
.ed-herramientas button span { font-size: 1.35rem; }
.ed-herramientas button:hover { background: rgba(255, 255, 255, .08); }
.ed-herramientas button.activo { background: rgba(244, 217, 216, .2); color: #fff; }
.ed-panel { background: var(--papel); border-right: 1px solid var(--linea); overflow-y: auto; padding: 1rem; }
.ed-panel h4 { font-family: var(--serif); font-size: 1.35rem; color: var(--vino); margin: 0 0 .7rem; font-weight: 500; }
.ed-panel h5 { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--suave); margin: 1.1rem 0 .5rem; font-weight: 500; }
.ed-ayuda { color: var(--suave); font-size: .8rem; line-height: 1.45; }
.ed-ancho { width: 100%; margin-bottom: .5rem; }
.ed-chips { display: flex; gap: .3rem; margin-bottom: .8rem; }
.ed-chips button { flex: 1; border: 1px solid var(--linea); background: none; border-radius: 999px; padding: .35rem .5rem; font-size: .75rem; cursor: pointer; color: var(--suave); }
.ed-chips button.activo { background: var(--rosa); color: var(--vino); border-color: transparent; }
.ed-plantillas { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.ed-plantillas button { padding: 0; border: none; background: none; cursor: pointer; display: grid; gap: .3rem; color: var(--suave); font-size: .75rem; }
.ed-plantillas .lienzo-marco { border-radius: 8px; box-shadow: 0 0 0 1px var(--linea); transition: transform .2s, box-shadow .2s; }
.ed-plantillas button:hover .lienzo-marco { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--vino); }
.ed-lista { display: grid; gap: .45rem; }
.ed-texto-tipo { text-align: left; border: 1px solid var(--linea); background: #fff; border-radius: 10px; padding: .7rem .8rem; cursor: pointer; color: var(--tinta); }
.ed-texto-tipo:hover { border-color: var(--vino); }
.ed-fuentes { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.ed-fuentes button { border: 1px solid var(--linea); background: #fff; border-radius: 10px; padding: .55rem .4rem; cursor: pointer; font-size: 1.05rem; color: var(--tinta); }
.ed-fotos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.ed-fotos button { padding: 0; border: none; border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: pointer; background: var(--crema); }
.ed-fotos img { width: 100%; height: 100%; object-fit: cover; }
.ed-fotos button:hover { outline: 2px solid var(--vino); }
.ed-formas { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.ed-formas button { border: none; background: none; cursor: pointer; display: grid; justify-items: center; gap: .2rem; color: var(--suave); font-size: .7rem; padding: .3rem; border-radius: 8px; }
.ed-formas button:hover { background: var(--crema); }
.ed-mini-forma { display: block; width: 52px; height: 52px; }
.ed-mini-forma .el-figura, .ed-mini-forma svg { width: 100%; height: 100%; display: block; }
.ed-stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: .2rem; }
.ed-stickers button { border: none; background: none; font-size: 1.5rem; cursor: pointer; border-radius: 8px; padding: .2rem; }
.ed-stickers button:hover { background: var(--crema); transform: scale(1.1); }
.ed-muestras { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; }
.ed-muestras button, .ed-muestra-libre { aspect-ratio: 1; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--linea); cursor: pointer; padding: 0; }
.ed-muestras button.activo { box-shadow: 0 0 0 3px var(--vino); }
.ed-muestra-libre { position: relative; overflow: hidden; background: conic-gradient(#F4D9D8, #E6DDF3, #DCEBF7, #DDF0E6, #FBE3D3, #F4D9D8); }
.ed-muestra-libre input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; margin: 0; padding: 0; }

.ed-escenario { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
/* Una sola fila (se desliza de lado): así el lienzo no salta al cambiar de elemento */
.ed-props { display: flex; flex-wrap: nowrap; align-items: center; gap: .3rem; margin: .6rem .8rem 0; padding: .35rem .5rem; height: 50px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: thin; background: var(--papel); border-radius: 12px; box-shadow: 0 6px 16px -10px rgba(90, 31, 41, .35); }
.ed-props > * { flex: none; }
.ed-props select, .ed-props input[type="number"] { width: auto; margin: 0; padding: .3rem .4rem; font-size: .85rem; border-radius: 8px; }
.ed-props input[type="number"] { width: 4.2rem; }
.ed-props input[type="range"] { width: 84px; margin: 0; padding: 0; border: none; background: none; accent-color: var(--vino); }
.ed-props input[type="color"] { width: 28px; height: 28px; padding: 0; margin: 0; border: none; background: none; cursor: pointer; }
.ed-campo { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--suave); }
.ed-num { display: inline-flex; align-items: center; }
.ed-colores { display: inline-flex; align-items: center; gap: .2rem; }
.ed-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--linea); cursor: pointer; padding: 0; }
.ed-color.activo { box-shadow: 0 0 0 2px var(--vino); }
.ed-sep { width: 1px; height: 26px; background: var(--linea); margin: 0 .2rem; }

.ed-zona { overflow: auto; display: grid; place-items: center; padding: 16px; min-height: 0; }
.ed-marco { flex: none; box-shadow: 0 18px 40px -16px rgba(60, 30, 40, .45); overflow: visible; }
.ed-lienzo { overflow: visible; touch-action: none; user-select: none; }
.ed-lienzo .el { cursor: move; }
.ed-lienzo .el.escribiendo { cursor: text; user-select: text; }
.ed-lienzo .el.escribiendo .el-texto { outline: 2px dashed rgba(140, 74, 98, .5); outline-offset: 4px; cursor: text; }
.ed-lienzo .el:hover:not(.activo) { outline: calc(1.5px / var(--k)) solid rgba(140, 74, 98, .45); }
.ed-lienzo .el.con-enlace::after { content: '🔗'; position: absolute; top: calc(-10px / var(--k)); right: calc(-10px / var(--k)); font-size: calc(14px / var(--k)); }
.ed-sel { position: absolute; z-index: 9999; pointer-events: none; outline: calc(2px / var(--k)) solid #8C4A62; transform-origin: center; }
.ed-h { position: absolute; width: calc(14px / var(--k)); height: calc(14px / var(--k)); background: #fff; border: calc(2px / var(--k)) solid #8C4A62; border-radius: 50%; pointer-events: auto; transform: translate(-50%, -50%); touch-action: none; }
.ed-h-nw { left: 0; top: 0; cursor: nwse-resize; } .ed-h-n { left: 50%; top: 0; cursor: ns-resize; } .ed-h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.ed-h-e { left: 100%; top: 50%; cursor: ew-resize; } .ed-h-se { left: 100%; top: 100%; cursor: nwse-resize; } .ed-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.ed-h-sw { left: 0; top: 100%; cursor: nesw-resize; } .ed-h-w { left: 0; top: 50%; cursor: ew-resize; }
.ed-rot { position: absolute; left: 50%; top: calc(-34px / var(--k)); width: calc(26px / var(--k)); height: calc(26px / var(--k)); transform: translateX(-50%); display: grid; place-items: center; background: #fff; color: #8C4A62; border: calc(1.5px / var(--k)) solid #8C4A62; border-radius: 50%; font-size: calc(15px / var(--k)); pointer-events: auto; cursor: grab; touch-action: none; }
.ed-guia { position: absolute; z-index: 9998; background: #E0559A; pointer-events: none; }
.ed-guia.v { left: 300px; top: 0; width: calc(1px / var(--k)); height: 800px; }
.ed-guia.h { top: 400px; left: 0; height: calc(1px / var(--k)); width: 600px; }

.ed-paginas { display: flex; align-items: center; gap: .8rem; padding: .5rem 16px; background: var(--papel); border-top: 1px solid var(--linea); min-width: 0; }
.ed-minis { display: flex; gap: .5rem; overflow-x: auto; flex: 1; min-width: 0; padding: .25rem .1rem; scrollbar-width: thin; }
.ed-mini { position: relative; flex: none; width: 54px; padding: 0; border: none; background: none; cursor: pointer; border-radius: 6px; }
.ed-mini .lienzo-marco { border-radius: 5px; box-shadow: 0 0 0 1px var(--linea); }
.ed-mini.activa .lienzo-marco { box-shadow: 0 0 0 3px var(--vino); }
.ed-mini span { position: absolute; bottom: 2px; right: 4px; font-size: .65rem; color: var(--suave); background: rgba(255, 255, 255, .85); border-radius: 4px; padding: 0 .25rem; }

@media (max-width: 820px) {
  .ed-barra { flex-wrap: wrap; gap: .3rem; padding: .4rem 10px; }
  .ed-estado { order: 3; flex-basis: 100%; }
  .ed-cuerpo, .ed.sin-panel .ed-cuerpo { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .ed-herramientas { grid-row: 1; flex-direction: row; justify-content: space-around; padding: .25rem; }
  .ed-panel { grid-row: 2; }
  .ed-escenario { grid-row: 3; }
  .ed-herramientas button { flex: 1; padding: .35rem .1rem; }
  .ed-herramientas button span { font-size: 1.15rem; }
  .ed-panel { max-height: 36vh; border-right: none; border-bottom: 1px solid var(--linea); }
  .ed-props { margin: .4rem .5rem 0; }
  .ed-zona { padding: 10px; }
  .ed-paginas { flex-wrap: wrap; gap: .4rem; padding: .4rem 10px; }
  .ed-minis { flex-basis: 100%; }
  .ed-plantillas { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Editor: selección, recorte, cuadrícula y arrastrar ---------- */
.ed-props.con-cinta { height: auto; padding: .25rem; overflow: hidden; align-items: stretch; gap: .4rem; }
.ed-props.con-cinta .ed-cinta { flex: 1 1 auto; min-width: 0; }
.ed-props.con-cinta .cinta { border: none; box-shadow: none; border-radius: 8px; }
.ed-listo { align-self: center; flex: none; padding: .5rem 1rem; }
.ed-sel.multi { outline-style: dashed; }
.ed-sel.recortando { outline: calc(2px / var(--k)) dashed #E0559A; }
.ed-lienzo.multi .el.activo { outline: calc(1.5px / var(--k)) dashed rgba(140, 74, 98, .8); }
.ed-candado { position: absolute; top: calc(-14px / var(--k)); right: calc(-14px / var(--k)); font-size: calc(15px / var(--k)); line-height: 1; padding: calc(4px / var(--k)); background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.ed-lienzo .el.bloqueado { cursor: default; }
.ed-lienzo.con-brocha, .ed-lienzo.con-brocha .el { cursor: copy; }
.ed-marquesina { position: absolute; z-index: 9997; border: calc(1px / var(--k)) solid #8C4A62; background: rgba(140, 74, 98, .1); pointer-events: none; }
.ed-cuadricula { position: absolute; inset: 0; z-index: 9990; pointer-events: none; background-image: linear-gradient(rgba(64, 140, 220, .2) 1px, transparent 1px), linear-gradient(90deg, rgba(64, 140, 220, .2) 1px, transparent 1px); background-size: 50px 50px; }
.ed-cuadricula::after { content: ''; position: absolute; inset: 40px; border: 1px dashed rgba(224, 85, 154, .6); }
.ed-zona.soltando { outline: 3px dashed var(--vino); outline-offset: -10px; background: rgba(244, 217, 216, .35); }

/* Menú del clic derecho */
.ed-ctx { position: fixed; z-index: 260; min-width: 230px; padding: .3rem; background: #fff; border: 1px solid var(--linea); border-radius: 10px; box-shadow: 0 14px 34px -12px rgba(60, 30, 40, .45); font-size: .85rem; }
.ed-ctx button { display: flex; justify-content: space-between; gap: 1rem; width: 100%; padding: .42rem .6rem; border: none; background: none; border-radius: 6px; cursor: pointer; text-align: left; color: var(--tinta); font: inherit; }
.ed-ctx button:hover { background: var(--rosa); color: var(--vino); }
.ed-ctx kbd { font-family: inherit; font-size: .72rem; color: var(--suave); }
.ed-ctx hr { border: none; border-top: 1px solid var(--linea); margin: .25rem 0; }

/* Paneles: efectos, editar foto, forma, fondo y capas */
.ed-rango { display: grid; gap: .15rem; margin: .35rem 0 .55rem; font-size: .78rem; color: var(--suave); }
.ed-rango span { display: flex; justify-content: space-between; }
.ed-rango output { color: var(--tinta); font-variant-numeric: tabular-nums; }
.ed-rango input { width: 100%; margin: 0; padding: 0; border: none; background: none; accent-color: var(--vino); }
.ed-rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin-bottom: .4rem; }
.ed-rejilla.tres { grid-template-columns: repeat(3, 1fr); }
.ed-rejilla .ed-btn, .ed-panel .ed-btn.ed-ancho { border: 1px solid var(--linea); background: #fff; font-size: .78rem; padding: .4rem .3rem; white-space: normal; }
.ed-rejilla .ed-btn.activo { background: var(--vino); color: var(--papel); }
.ed-medidas { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-bottom: .5rem; }
.ed-medidas label { display: grid; gap: .1rem; font-size: .72rem; color: var(--suave); }
.ed-medidas input { margin: 0; padding: .3rem .35rem; font-size: .82rem; width: 100%; }
.ed-campo-fila { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .78rem; color: var(--suave); margin: .3rem 0 .5rem; }
.ed-campo-fila select { width: auto; margin: 0; padding: .3rem; }
.ed-panel .ed-colores { flex-wrap: wrap; }
.ed-panel input[type="color"] { width: 30px; height: 28px; padding: 0; margin: 0; border: none; background: none; cursor: pointer; }
.ed-panel h5 small { text-transform: none; letter-spacing: 0; }
.ed-capas { display: grid; gap: .25rem; }
.ed-capa { display: flex; align-items: center; gap: .35rem; padding: .35rem .45rem; border: 1px solid var(--linea); border-radius: 8px; background: #fff; cursor: pointer; font-size: .8rem; }
.ed-capa:hover { border-color: var(--vino); }
.ed-capa.activa { background: var(--rosa); border-color: var(--vino); }
.ed-capa-ico { width: 1.4rem; text-align: center; }
.ed-capa-nombre { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-capa button { border: none; background: none; cursor: pointer; padding: .1rem .25rem; border-radius: 5px; }
.ed-capa button:hover { background: rgba(140, 74, 98, .12); }
.ed-efectos, .ed-filtros { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.ed-efectos button, .ed-filtros button { display: grid; justify-items: center; gap: .2rem; padding: .35rem .2rem; border: 1px solid var(--linea); border-radius: 8px; background: #fff; cursor: pointer; color: var(--suave); font-size: .7rem; overflow: hidden; }
.ed-efectos button > span { display: grid; place-items: center; height: 44px; line-height: 1; }
.ed-filtros img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.ed-filtros button > span { font-size: 1.6rem; height: 52px; display: grid; place-items: center; }
.ed-efectos button.activo, .ed-filtros button.activo, .ed-formas button.activo, .ed-patrones button.activo, .ed-papeles button.activo { box-shadow: 0 0 0 2px var(--vino); border-color: transparent; }
.ed-patrones { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.ed-patrones button { aspect-ratio: 1; border: 1px solid var(--linea); border-radius: 8px; cursor: pointer; display: grid; align-items: end; padding: .15rem; font-size: .6rem; color: var(--suave); background-color: #FFFDF8; }
.ed-patrones button small { background: rgba(255, 255, 255, .85); border-radius: 4px; }
.ed-papeles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.ed-papeles button { display: grid; justify-items: center; gap: .2rem; padding: .15rem 0; border: none; background: none; cursor: pointer; font-size: .62rem; line-height: 1.15; text-align: center; color: var(--suave); border-radius: 8px; }
.ed-papeles .ce-muestra { width: 54px; height: 72px; }
.ed-papeles .ce-muestra .carta-deco { transform: scale(.09); }
.ed-degradado-libre { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0; font-size: .78rem; color: var(--suave); }
.ed-degradado-libre label { display: flex; align-items: center; gap: .3rem; }
.ed-degradado-libre .ed-rango { flex: 1 1 100%; margin: 0; }
.ed-mini-mascara { background: linear-gradient(135deg, #EBC3C1, #C9A6D6); }
.ed-mini-polaroid { border: 5px solid #fff; border-bottom-width: 14px; box-sizing: border-box; background: linear-gradient(135deg, #EBC3C1, #C9A6D6); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); transform: rotate(-4deg); }
.ed-mini-forma.ed-mini-linea { display: grid; align-items: center; }
.ed-mini-forma.ed-mini-linea .el-figura { height: 4px; }
.ed-mini-cuadricula { display: grid; width: 52px; height: 52px; gap: 3px; }
.ed-mini-cuadricula i { background: #EBC3C1; border-radius: 3px; }
.ed-mini-cuadricula.c2h { grid-template-columns: 1fr 1fr; }
.ed-mini-cuadricula.c2v { grid-template-rows: 1fr 1fr; }
.ed-mini-cuadricula.c2h i:nth-child(n+3), .ed-mini-cuadricula.c2v i:nth-child(n+3), .ed-mini-cuadricula.c3 i:nth-child(4) { display: none; }
.ed-mini-cuadricula.c3, .ed-mini-cuadricula.c4 { grid-template: 1fr 1fr / 1fr 1fr; }
.ed-mini-cuadricula.c3 i:first-child { grid-column: 1 / 3; }

/* ============================================================
   Cinta estilo Word (cartas y textos del editor de diseño)
   ============================================================ */
.cinta { min-width: 0; background: var(--papel, #FFFDF8); border: 1px solid var(--linea, #E8DCD6); border-radius: 12px; box-shadow: 0 6px 14px -10px rgba(90, 31, 41, .35); font-family: var(--sans, system-ui); font-size: .82rem; color: var(--tinta, #3B2A2E); }
.ci-pestanas { display: flex; gap: .2rem; padding: .2rem .5rem 0; border-bottom: 1px solid var(--linea); }
.ci-pestanas button { border: none; background: none; padding: .3rem .8rem .35rem; margin-bottom: -1px; font: inherit; color: var(--suave); cursor: pointer; border-bottom: 2.5px solid transparent; }
.ci-pestanas button[aria-selected="true"] { color: var(--vino); border-bottom-color: var(--vino); font-weight: 600; }
.ci-cuerpo { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: thin; padding: .3rem .2rem .15rem; }
.ci-grupo { flex: none; display: flex; flex-direction: column; justify-content: space-between; padding: 0 .45rem; border-right: 1px solid var(--linea); }
.ci-grupo:last-child { border-right: none; }
.ci-grupo.oculto { display: none; }
.ci-g-cuerpo { display: flex; align-items: center; gap: .2rem; flex: 1; }
.ci-g-cuerpo:has(> .ci-fila) { flex-direction: column; align-items: flex-start; justify-content: center; gap: .1rem; }
.ci-grupo > small { display: block; text-align: center; font-size: .66rem; color: var(--suave); padding-top: .1rem; white-space: nowrap; }
.ci-fila { display: flex; align-items: center; gap: .1rem; }
.ci-col { display: flex; flex-direction: column; gap: .1rem; }
.ci-col.ci-texto .ci-b { justify-content: flex-start; width: 100%; }
.ci-b { display: inline-flex; align-items: center; justify-content: center; gap: .15rem; min-width: 30px; height: 30px; padding: 0 .4rem; border: 1px solid transparent; border-radius: 6px; background: none; color: inherit; font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap; }
.ci-b:hover { background: var(--rosa); color: var(--vino); }
.ci-b.activo { background: #F1E1E6; border-color: rgba(140, 74, 98, .35); color: var(--vino); }
.ci-b sup, .ci-b sub { font-size: .6em; }
.ci-dd i { font-style: normal; font-size: .6rem; opacity: .7; }
.ci-partido { display: inline-flex; }
.ci-partido > .ci-b:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: .2rem; }
.ci-partido > .ci-dd { min-width: 15px; padding: 0 .15rem; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ci-grande { flex-direction: column; height: auto; min-height: 58px; padding: .2rem .5rem; font-size: .74rem; gap: .1rem; }
.ci-grande span { font-size: 1.45rem; line-height: 1; }
.ci-grande.activo span { animation: latido 1s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(1.15); } }
.cinta select.ci-fuente { width: 150px; height: 28px; margin: 0; padding: 0 .3rem; font-size: .8rem; border-radius: 6px; }
.cinta input.ci-tam { width: 56px; height: 28px; margin: 0 .15rem 0 0; padding: 0 .3rem; font-size: .8rem; border-radius: 6px; }
.ci-icono-color { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; }
.ci-icono-color span { display: block; width: 18px; height: 4px; border-radius: 2px; margin-top: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.ci-efecto { color: #4A6FA5; text-shadow: 0 0 4px rgba(74, 111, 165, .6); font-weight: 700; }
.ci-estilos { display: grid; grid-template-columns: repeat(5, auto); gap: .25rem; }
.ci-estilo { min-width: 74px; height: 52px; padding: .3rem .55rem; border: 1px solid var(--linea); border-radius: 6px; background: #fff; cursor: pointer; font-family: var(--serif); font-size: .95rem; color: var(--tinta); }
.ci-estilo:hover { border-color: var(--vino); }
.ci-estilo.activo { box-shadow: 0 0 0 2px var(--vino); }
.ci-simbolos { display: grid; grid-template-columns: repeat(8, 28px); gap: 1px; }
.ci-simbolos .ci-b { min-width: 28px; height: 26px; padding: 0; }
.ci-simbolos.grande { grid-template-columns: repeat(8, 32px); }
.cinta.sin-area .ci-cuerpo { opacity: .55; }
.ci-menu { position: fixed; z-index: 300; min-width: 200px; max-width: min(330px, calc(100vw - 16px)); max-height: 70vh; overflow-y: auto; padding: .35rem; background: #fff; border: 1px solid var(--linea, #E8DCD6); border-radius: 10px; box-shadow: 0 14px 34px -12px rgba(60, 30, 40, .45); font-family: var(--sans); font-size: .85rem; color: var(--tinta); }
.ci-op { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; padding: .45rem .6rem; border: none; border-radius: 6px; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.ci-op:hover { background: var(--rosa, #F4D9D8); }
.ci-op input[type="color"] { width: 28px; height: 24px; margin: 0; padding: 0; border: none; background: none; cursor: pointer; }
.ci-menu hr { border: none; border-top: 1px solid var(--linea); margin: .3rem 0; }
.ci-muestras { display: grid; grid-template-columns: repeat(10, 22px); gap: .3rem; padding: .3rem; }
.ci-muestra { width: 22px; height: 22px; padding: 0; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; cursor: pointer; }
.ci-muestra:hover, .ci-muestra[aria-pressed="true"] { outline: 2px solid var(--vino); outline-offset: 1px; }
.ci-nota { margin: .3rem .4rem; font-size: .75rem; color: var(--suave); }
.ci-efectos .ci-op span { min-width: 2.2rem; font-size: 1.25rem; font-weight: 700; color: #8C4A62; }
.ci-buscar { display: grid; gap: .4rem; min-width: 250px; padding: .3rem; }
.ci-buscar input { margin: 0; padding: .45rem .55rem; font-size: .85rem; }
.ci-buscar .ci-fila { flex-wrap: wrap; gap: .3rem; }
.ci-buscar .ci-op { width: auto; border: 1px solid var(--linea); }
.carta-texto sub, .carta-texto sup, .el-texto sub, .el-texto sup { font-size: .7em; }

/* ---------- Cartas: escribir en papel o diseño libre ---------- */
.modo-carta { display: grid; gap: .7rem; margin-bottom: .7rem; }
.modo-chips { flex-wrap: wrap; }
.modo-diseno { display: grid; gap: .7rem; padding: .8rem; border: 1px dashed var(--linea); border-radius: 12px; }
.modo-diseno[hidden] { display: none; }
.modo-minis { display: flex; gap: .6rem; overflow-x: auto; padding: .2rem; }
.modo-mini { position: relative; flex: none; width: 120px; padding: 0; border: none; background: none; cursor: pointer; border-radius: 8px; }
.modo-mini .lienzo-marco { border-radius: 8px; box-shadow: 0 0 0 1px var(--linea), 0 6px 14px -8px rgba(60, 30, 40, .4); }
.modo-mini:hover .lienzo-marco { box-shadow: 0 0 0 2px var(--vino); }
.modo-mini span { position: absolute; bottom: 4px; right: 6px; font-size: .7rem; background: rgba(255, 255, 255, .85); border-radius: 4px; padding: 0 .3rem; }
.papel.papel-diseno { padding: 0; background: none; box-shadow: none; border: none; }

@media (max-width: 820px) {
  .cinta select.ci-fuente { width: 118px; }
  .ci-estilos { grid-template-columns: repeat(5, 64px); }
  .ci-estilo { min-width: 0; height: 44px; font-size: .8rem; padding: .2rem; }
  .ed-props.con-cinta { flex-direction: column; }
  .ed-listo { align-self: flex-end; padding: .35rem .9rem; }
}

/* ---------- Animaciones de los elementos ----------
   Entrada: se ven una vez al abrir la página. "∞": se repiten siempre.
   --dl = retraso, --ad = velocidad (multiplica la duración). */
.el-in[class*="anim-"] { animation-delay: var(--dl, 0s); animation-fill-mode: both; }
.anim-aparecer { animation: a-aparecer calc(1s * var(--ad, 1)) ease-out both; }
.anim-subir { animation: a-subir calc(.9s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1) both; }
.anim-bajar { animation: a-bajar calc(.9s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1) both; }
.anim-izquierda { animation: a-izquierda calc(.9s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1) both; }
.anim-derecha { animation: a-derecha calc(.9s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1) both; }
.anim-zoom { animation: a-zoom calc(.8s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1.2) both; }
.anim-rebote { animation: a-rebote calc(1.1s * var(--ad, 1)) ease both; }
.anim-girarEntrada { animation: a-girarEntrada calc(1s * var(--ad, 1)) cubic-bezier(.2, .8, .3, 1) both; }
.anim-maquina { animation: a-maquina calc(2.4s * var(--ad, 1)) steps(28, end) both; }
.anim-desenfoque { animation: a-desenfoque calc(1.2s * var(--ad, 1)) ease-out both; }
.anim-latido { animation: a-latido calc(1.3s * var(--ad, 1)) ease-in-out infinite; }
.anim-flotar { animation: a-flotar calc(3s * var(--ad, 1)) ease-in-out infinite; }
.anim-balanceo { animation: a-balanceo calc(2.4s * var(--ad, 1)) ease-in-out infinite; transform-origin: 50% 10%; }
.anim-brillo { animation: a-brillo calc(2.2s * var(--ad, 1)) ease-in-out infinite; }
.anim-titilar { animation: a-titilar calc(1.8s * var(--ad, 1)) ease-in-out infinite; }
.anim-girar { animation: a-girar calc(8s * var(--ad, 1)) linear infinite; }
.anim-pulso { animation: a-pulso calc(2.6s * var(--ad, 1)) ease-in-out infinite; }
.el-in.anim-latido, .el-in.anim-flotar, .el-in.anim-balanceo, .el-in.anim-brillo, .el-in.anim-titilar, .el-in.anim-girar, .el-in.anim-pulso { animation-delay: var(--dl, 0s); }
@keyframes a-aparecer { from { opacity: 0; } }
@keyframes a-subir { from { opacity: 0; transform: translateY(60px); } }
@keyframes a-bajar { from { opacity: 0; transform: translateY(-60px); } }
@keyframes a-izquierda { from { opacity: 0; transform: translateX(-80px); } }
@keyframes a-derecha { from { opacity: 0; transform: translateX(80px); } }
@keyframes a-zoom { from { opacity: 0; transform: scale(.3); } }
@keyframes a-rebote { 0% { opacity: 0; transform: scale(.3); } 50% { opacity: 1; transform: scale(1.12); } 70% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes a-girarEntrada { from { opacity: 0; transform: rotate(-200deg) scale(.4); } }
@keyframes a-maquina { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes a-desenfoque { from { opacity: 0; filter: blur(14px); } }
@keyframes a-latido { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.13); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes a-flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes a-balanceo { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes a-brillo { 0%, 100% { filter: drop-shadow(0 0 0 rgba(247, 220, 148, 0)); } 50% { filter: drop-shadow(0 0 12px rgba(247, 220, 148, .95)) brightness(1.08); } }
@keyframes a-titilar { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.85); } }
@keyframes a-girar { to { transform: rotate(360deg); } }
@keyframes a-pulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
/* En el editor todo queda quieto para trabajar (salvo al tocar «▶ Animación»); las miniaturas, siempre quietas */
.ed .lienzo:not(.animando) .el-in, .ed-plantillas .el-in, .ed-mini .el-in, .modo-mini .el-in, #impresion .el-in { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .el-in[class*="anim-"] { animation: none !important; } }

/* Panel de animaciones, categorías de plantillas y collages en el editor */
.ed-cats { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .8rem; }
.ed-cats button { border: 1px solid var(--linea); background: #fff; border-radius: 999px; padding: .25rem .65rem; font-size: .72rem; cursor: pointer; color: var(--suave); }
.ed-cats button.activo { background: var(--vino); color: var(--papel); border-color: transparent; }
.ed-anims { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .6rem; }
.ed-anims button { display: grid; justify-items: center; gap: .25rem; padding: .45rem .2rem; border: 1px solid var(--linea); border-radius: 8px; background: #fff; cursor: pointer; color: var(--suave); font-size: .66rem; line-height: 1.15; overflow: hidden; }
.ed-anims button.activo { box-shadow: 0 0 0 2px var(--vino); border-color: transparent; color: var(--vino); }
.ed-anim-muestra { display: inline-block; font-size: 1.3rem; --dl: 0s; animation-iteration-count: infinite !important; animation-duration: 1.6s; }
.ed-collages { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ed-collages button { display: grid; gap: .25rem; padding: .3rem; border: 1px solid var(--linea); border-radius: 10px; background: #fff; cursor: pointer; color: var(--suave); font-size: .72rem; }
.ed-collages button:hover { border-color: var(--vino); }
.ed-collages .collage { border-radius: 6px; }
.el.tipo-collage .collage { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; background: none; }

/* ---------- Imprimir ---------- */
@media print {
  #impresion .hoja.hoja-diseno { aspect-ratio: auto; min-height: 0; padding: 0; display: flex; justify-content: center; }
  #impresion .hoja.hoja-diseno .lienzo-marco { position: relative; inset: auto; width: 600px; height: 800px; }
  #impresion .lienzo { transform: none !important; }
  #impresion .hoja.hoja-diseno .hoja-num { display: none; }
  #impresion .el img { max-height: none; }
}
