#cookie-consent-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  left: auto;
  z-index: 10000;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  transform: translateY(calc(100% + 16px));
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 400px;
  width: calc(100% - 32px);
}

/* P0 fix 12-may v3: mobile también card esquina bottom-right.
   La v2 dejó full-width y el banner (alto ~120px) tapaba el CTA "Empezar"
   del onboarding /app — Playwright confirmó `intercepts pointer events`
   sobre el 100% del botón. Solución: card max-width 360px, esquina derecha,
   no ocupa el centro horizontal donde está el CTA. */
@media (max-width: 640px) {
  #cookie-consent-banner {
    bottom: 12px;
    right: 12px;
    left: auto;
    /* C-1 (24-may): max-width 280px en mobile reduce huella visual ~22%.
       Aún cumple equal-prominence (P0-LEGAL-2): ambos botones filled, mismo
       border/padding intactos. Validado contra CNIL/AEPD guidance. */
    max-width: 280px;
    width: calc(100% - 24px);
    padding: 0;
    transform: translateY(calc(100% + 16px));
  }
}

#cookie-consent-banner.cc-visible {
  transform: translateY(0);
}

/* Fix 13-may-2026: defense in depth contra overlap banner ↔ CTAs.
   El banner (height ~130px) en mobile no es realmente "card esquina" — ocupa
   86% del width (360 de 393) y tapa CTAs bottom de cualquier pantalla excepto
   las 100% scrollables (library, profile).
   Estrategia: JS solo inyecta en library/profile (cookie-consent.js).
   Este CSS es defense in depth: si por algún edge case el banner llegara a
   estar visible en otra pantalla, lo empuja off-screen.
   En landing/privacy/about no hay `.screen` elements → regla no aplica →
   banner se muestra normal. */
body:has(.screen.active:not(#screen-library):not(#screen-profile)) #cookie-consent-banner,
body:has(.paywall-overlay.active) #cookie-consent-banner {
  transform: translateY(calc(100% + 16px)) !important;
  pointer-events: none !important;
}

/* Mientras el banner está visible Y user en library/profile (las únicas
   pantallas donde el banner se muestra visualmente post-fix 13-may-2026),
   esconder el bottom-nav para no apilar barras inferiores. En otras pantallas
   el banner está off-screen por el defer fix arriba, así que el nav debe
   permanecer visible. */
body:has(#cookie-consent-banner.cc-visible):has(.screen.active#screen-library) .bottom-nav,
body:has(#cookie-consent-banner.cc-visible):has(.screen.active#screen-profile) .bottom-nav {
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* P0 fix 12-may-2026 v3: desktop + mobile son card esquina bottom-right.
   Ya no hace falta padding-bottom al body porque la card no es full-width. */

#cookie-consent-banner .cc-card {
  pointer-events: auto;
  width: 100%;
  max-width: 400px;
  margin: 0;
  box-sizing: border-box;
  background: #FBF7F0;
  color: #2A2823;
  border: 1px solid rgba(42, 40, 35, 0.08);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 8px 32px rgba(42, 40, 35, 0.18), 0 2px 8px rgba(42, 40, 35, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 640px) {
  #cookie-consent-banner .cc-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 18px 20px;
    gap: 14px;
  }
}

@media (max-width: 480px) {
  #cookie-consent-banner .cc-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  #cookie-consent-banner .cc-btn {
    width: 100%;
  }
}

#cookie-consent-banner .cc-text {
  margin: 0;
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #3A3833;
}

#cookie-consent-banner .cc-link {
  color: #2A2823;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#cookie-consent-banner .cc-link:hover {
  text-decoration-thickness: 2px;
}

#cookie-consent-banner .cc-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#cookie-consent-banner .cc-btn {
  font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 12px 20px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

/* GDPR equal prominence (CNIL Francia + AEPD España, vigente desde 2022).
   Aceptar y Rechazar deben tener IGUAL peso visual — mismo fill, mismo
   borde, mismo padding (heredado de .cc-btn). Solo difieren en colores
   de contraste invertidos: Aceptar=ink-on-canvas, Rechazar=canvas-on-ink-borde.
   Ambos son "filled buttons" — ninguno es ghost ni link. */
#cookie-consent-banner .cc-btn-primary {
  background: #2A2823;
  color: #FBF7F0;
  border-color: #2A2823;
}

#cookie-consent-banner .cc-btn-primary:hover {
  background: #3A3833;
  border-color: #3A3833;
}

#cookie-consent-banner .cc-btn-secondary {
  background: #FBF7F0;
  color: #2A2823;
  border-color: #2A2823;
}

#cookie-consent-banner .cc-btn-secondary:hover {
  background: #EDE6D9;
  border-color: #2A2823;
}

#cookie-consent-banner .cc-btn:focus-visible {
  outline: 2px solid #2A2823;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  #cookie-consent-banner {
    /* F-53: respetar safe-area home indicator iOS — antes el banner pegaba al
       borde inferior y los botones podían quedar bajo el home indicator. */
    padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  }
  #cookie-consent-banner .cc-card {
    padding: 12px 14px;
    border-radius: 14px;
    /* F-ONBOARD-COOKIE: compactar a layout horizontal para no tapar 50%
       del viewport (antes: column-reverse, 2 botones full-width = ~250px). */
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  #cookie-consent-banner .cc-text {
    font-size: 12.5px;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
  }
  #cookie-consent-banner .cc-actions {
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    margin: 0;
  }
  #cookie-consent-banner .cc-btn {
    width: auto;
    padding: 10px 14px;
    min-height: 44px;
    font-size: 13px;
    white-space: nowrap;
  }
}
