/* ============================================================
   CONEXA — Anuncios con tiras (js/anuncios.js)
   ------------------------------------------------------------
   Cuartillas clavadas en el tablón con tiras de arrancar. Cada
   tipo va en su papel: blanco, pajizo, celeste y hoja cuadriculada.
   También la ventana de colgar un anuncio y el botón "Colgar" de
   la barra de abajo. Se apoya en carnet.css y tablon.css.
   ============================================================ */
:root {
  --cx-pajizo:  #FFF3B8;
  --cx-celeste: #E4EEFF;
  --cx-cuadro:  rgba(11, 44, 115, 0.15);   /* la cuadrícula de la hoja de estudio */
}
body.dark {
  --cx-pajizo:  #EBDD9E;
  --cx-celeste: #D3DFF4;
  --cx-cuadro:  rgba(11, 44, 115, 0.17);
}

.cx-cuantos { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: var(--cx-claro-2); }
.cx-cuantos b { font: 400 16px var(--cx-num); color: #fff; }
.cx-solo-grande { display: none; }
@media (min-width: 769px) { .cx-solo-grande { display: inline-block; min-height: 38px; font-size: 14px; } }

.cx-anuncios { display: flex; flex-direction: column; gap: 26px; }
.cx-anuncio { width: 89%; transform: rotate(var(--r)); }
.cx-anuncio:nth-child(even) { align-self: flex-end; }
.cx-anuncio-papel { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2)) drop-shadow(0 12px 10px rgba(0, 0, 0, 0.4)); }
.cx-anuncio-cuerpo { position: relative; padding: 24px 16px 14px; background: var(--p) var(--cx-grano-papel); color: var(--cx-noche); border-bottom: 1.5px dashed var(--cx-regla); }
.cx-anuncio .cx-chincheta { position: absolute; left: 50%; top: -7px; margin-left: -9px; }
.cx-tipo {
  position: absolute; top: 13px; right: 12px; padding: 4px 7px 2px; border: 1.5px solid var(--cx-tampon); border-radius: 4px; color: var(--cx-tampon);
  font: 400 11px/1.1 var(--cx-num); letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(5deg);
}
.cx-anuncio h3 { margin: 0; padding-right: 68px; color: var(--cx-impreso); text-transform: uppercase; font-weight: 900; font-stretch: 66%; font-size: 30px; line-height: 0.94; text-wrap: balance; overflow-wrap: anywhere; }
.cx-anuncio-cuerpo > p { margin: 9px 0 0; font-size: 14.5px; line-height: 1.36; overflow-wrap: anywhere; }
.cx-quien { margin-top: 12px; display: flex; align-items: center; gap: 9px; font-size: 12.5px; line-height: 1.3; color: var(--cx-tinta-2); }
.cx-quien b { color: var(--cx-noche); font-weight: 800; }
.cx-quien > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.cx-van {
  width: 100%; min-height: 44px; margin-top: 10px; padding: 8px 0 0; border: 0; border-top: 1px solid var(--cx-regla); background: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 8px; font: 400 13px/1.25 var(--cx-letra); color: var(--cx-tinta-2);
}
.cx-pila { flex: none; display: flex; }
.cx-pila .cx-retrato { width: 22px; height: 28px; margin-left: -7px; box-shadow: 0 0 0 1.5px var(--p); font-size: 11px; }
.cx-pila .cx-retrato:first-child { margin-left: 0; }
.cx-van > span:last-child { flex: 1; min-width: 0; }
.cx-van u { color: var(--cx-impreso); font-weight: 800; text-underline-offset: 3px; }
.cx-acciones { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cx-estampa { padding: 5px 9px 3px; border: 2px solid var(--cx-tampon); border-radius: 6px; color: var(--cx-tampon); font: 400 13px/1.1 var(--cx-num); letter-spacing: 0.06em; text-transform: uppercase; transform: rotate(-4deg); }
.cx-estampa.gorda { padding: 7px 12px 4px; border-width: 3px; font-size: 17px; }
.cx-estampa.nueva { --r: -4deg; animation: cxSella .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.cx-anuncio .cx-enlace { padding: 10px 2px; color: var(--cx-impreso); font-weight: 800; }
.cx-an-tiras { display: flex; align-items: flex-start; }
.cx-an-tira {
  flex: 1 1 0; min-width: 0; height: 94px; padding: 0; border: 0; border-left: 1.5px dashed var(--cx-regla);
  background: var(--p) var(--cx-grano-papel); color: var(--cx-impreso); cursor: pointer; display: grid; place-items: center;
  transform-origin: 50% 0; transition: transform .15s ease;
}
.cx-an-tira:first-child { border-left: 0; }
.cx-an-tira span { writing-mode: vertical-rl; font-weight: 800; font-stretch: 78%; font-size: 12px; line-height: 1; letter-spacing: 0.05em; text-transform: uppercase; }
.cx-an-tira:nth-child(odd) { transform: rotate(-1.2deg); }
.cx-an-tira:nth-child(3n) { transform: rotate(1.4deg); }
/* Lo que queda de una tira arrancada: un pico de papel rasgado */
.cx-an-tira.fuera { height: 13px; transform: none; cursor: default; clip-path: polygon(0 0, 100% 0, 100% 62%, 86% 100%, 72% 58%, 58% 96%, 43% 52%, 29% 100%, 14% 60%, 0 90%); }
.cx-an-tira:disabled { cursor: default; color: var(--cx-impreso); opacity: 1; }
.cx-an-tira.cae { animation: cxTiraCae .45s cubic-bezier(.4, 0, .7, .2) forwards; }
@media (hover: hover) { .cx-an-tira:not(:disabled):not(.fuera):hover { transform: rotate(-5deg); } }
/* La hoja cuadriculada de los anuncios de estudio */
.cx-anuncio.cuadros .cx-anuncio-cuerpo, .cx-anuncio.cuadros .cx-an-tira {
  background: linear-gradient(var(--cx-cuadro) 1px, transparent 1px) 0 0 / 15px 15px, linear-gradient(90deg, var(--cx-cuadro) 1px, transparent 1px) 0 0 / 15px 15px, var(--p) var(--cx-grano-papel);
}
.cx-quedan { margin: 10px 0 0; font-size: 13px; line-height: 1.35; color: var(--cx-claro-2); }
.cx-quedan b { font: 400 14px var(--cx-num); color: #fff; }
.cx-anuncio.recien { animation: cxSeCuelga .55s cubic-bezier(.2, .9, .25, 1.15) both; }
.cx-tb .cx-anuncio-papel :focus-visible { outline-color: var(--cx-impreso); }

.cx-hueco-papel {
  width: 89%; align-self: flex-end; padding: 18px 16px; border: 2px dashed rgba(255, 255, 255, 0.55); border-radius: 4px; background: none; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 4px; transform: rotate(.8deg); color: #fff;
}
.cx-hueco-papel b { font-weight: 900; font-stretch: 66%; font-size: 24px; line-height: 1; text-transform: uppercase; }
.cx-hueco-papel small { font-size: 13.5px; line-height: 1.35; color: var(--cx-claro-2); }
.cx-vacio-postit {
  position: relative; align-self: center; width: 86%; padding: 30px 20px 24px; transform: rotate(1.6deg); color: var(--cx-impreso);
  background: linear-gradient(172deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 36%), var(--cx-postit);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 22px 22px -14px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; gap: 12px;
}
.cx-vacio-postit p { margin: 0; font: 700 27px/1.02 'Caveat', 'Segoe Print', 'Bradley Hand', cursive; }
.cx-vacio-postit .cx-chincheta { position: absolute; left: 50%; top: -7px; margin-left: -9px; }

/* ── Las ventanas de los anuncios ─────────────────────────────── */
.cx-an-fichas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cx-an-ficha {
  min-width: 0; padding: 11px 12px 12px; border-radius: 16px; border: 2px solid var(--cx-borde); background: var(--cx-papel); box-shadow: 0 3px 0 var(--cx-borde);
  color: var(--cx-tinta); cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px;
  transition: transform .14s cubic-bezier(.2, 1.4, .4, 1);
}
.cx-an-ficha b { font-weight: 800; font-size: 17px; line-height: 1.15; }
.cx-an-ficha small { font-size: 13px; line-height: 1.25; color: var(--cx-gris); }
.cx-an-ficha[aria-pressed="true"] { background: var(--cx-amarillo); color: var(--cx-noche); border-color: var(--cx-noche); box-shadow: 0 5px 0 var(--cx-noche); transform: rotate(-1.5deg); }
.cx-an-ficha[aria-pressed="true"] small { color: #46557A; }
.cx-plazas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cx-cuando { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cx-plaza, .cx-diab {
  min-width: 0; height: 54px; padding: 0; border-radius: 14px; border: 2px solid var(--cx-borde); background: var(--cx-papel); box-shadow: 0 3px 0 var(--cx-borde);
  color: var(--cx-tinta); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.cx-plaza { font: 400 23px var(--cx-num); }
.cx-diab b { font-weight: 800; font-stretch: 85%; font-size: 14.5px; line-height: 1.1; }
.cx-diab small { font: 400 12px/1 var(--cx-num); color: var(--cx-gris); }
.cx-plaza[aria-pressed="true"], .cx-diab[aria-pressed="true"] { background: var(--cx-amarillo); color: var(--cx-noche); border-color: var(--cx-noche); box-shadow: 0 3px 0 var(--cx-noche); }
.cx-diab[aria-pressed="true"] small { color: #46557A; }
.cx-fila-int { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 2px solid var(--cx-borde); background: var(--cx-papel); }
.cx-fila-int > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cx-fila-int b { font-weight: 800; font-size: 15.5px; line-height: 1.2; }
.cx-fila-int small { font-size: 13px; line-height: 1.3; color: var(--cx-gris); overflow-wrap: anywhere; }
.cx-fila-int .cx-interruptor { border-color: var(--cx-borde); background: var(--cx-fondo); }
.cx-fila-int .cx-interruptor i { background: var(--cx-borde); }
.cx-fila-int .cx-interruptor[aria-checked="true"] { background: var(--cx-amarillo); border-color: var(--cx-noche); }
.cx-fila-int .cx-interruptor[aria-checked="true"] i { background: var(--cx-noche); }
.cx-previa { padding: 24px 14px 18px; border-radius: 18px; background: var(--cx-fieltro); display: flex; justify-content: center; }
.cx-previa .cx-anuncio { width: min(100%, 286px); pointer-events: none; }
.cx-normas { margin: 0; padding: 0; list-style: none; }
.cx-normas li { padding: 12px 0; border-top: 1.5px dashed var(--cx-linea); font-size: 15px; line-height: 1.4; color: var(--cx-gris); }
.cx-normas li:first-child { border-top: 0; padding-top: 0; }
.cx-normas li b { color: var(--cx-tinta); }

/* ── El botón de colgar, en el centro de la barra de abajo ─────── */
@media (max-width: 768px) {
  .cx-barra-in { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cx-colgar {
    position: relative; min-width: 0; border: 0; background: none; cursor: pointer; padding: 0 0 9px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
    color: #fff; font: 800 11px var(--cx-letra); font-stretch: 78%; letter-spacing: 0.12em; text-transform: uppercase;
  }
  .cx-colgar i {
    width: 52px; height: 52px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center;
    background: var(--cx-amarillo); color: var(--cx-noche); border: 2px solid var(--cx-noche); box-shadow: 0 4px 0 #04102E;
    transition: transform .08s ease, box-shadow .08s ease;
  }
  .cx-colgar:active i { transform: translateY(3px); box-shadow: 0 1px 0 #04102E; }
  .cx-colgar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
}

@keyframes cxSeCuelga   { from { opacity: 0; transform: translateY(-18px) rotate(var(--r, 0deg)) scale(1.04); } }
@keyframes cxTiraCae { 30% { transform: translateY(-4px) rotate(-10deg); } 100% { transform: translateY(170px) rotate(-38deg); opacity: 0; } }
