/* Celaeno Books · versión móvil. Las páginas usan estilos en línea, por eso hace falta !important. */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  #dc-root, #dc-root * { min-width: 0; }
  #dc-root img { max-width: 100%; }

  /* Márgenes laterales más estrechos */
  #dc-root [style*="max-width: 1280px"],
  #dc-root [style*="max-width: 1200px"],
  #dc-root [style*="max-width: 1100px"] { padding-left: 16px !important; padding-right: 16px !important; }
  #dc-root section > div[style*="padding: 64px"],
  #dc-root section > div[style*="padding: 72px"],
  #dc-root section > div[style*="padding: 80px"],
  #dc-root section > div[style*="padding: 96px"] { padding-top: 40px !important; padding-bottom: 40px !important; }
  #dc-root [style*="gap: 48px"], #dc-root [style*="gap: 56px"], #dc-root [style*="gap: 64px"] { gap: 28px !important; }

  /* Tipografía */
  #dc-root h1 { font-size: 40px !important; line-height: 1.08 !important; }
  #dc-root h2 { font-size: 30px !important; line-height: 1.12 !important; }
  #dc-root h3 { font-size: 22px !important; }
  #dc-root [style*="font-size: 19px"], #dc-root [style*="font-size: 20px"] { font-size: 17px !important; }

  /* Rejillas fijas: una columna */
  #dc-root [style*="grid-template-columns: repeat(2, minmax(0, 1fr))"],
  #dc-root [style*="grid-template-columns: repeat(3, minmax(0, 1fr))"],
  #dc-root [style*="grid-template-columns: repeat(3, 1fr)"],
  #dc-root [style*="grid-template-columns: repeat(4, minmax(0, 1fr))"],
  #dc-root [style*="grid-template-columns: minmax(0, 2fr) minmax(0, 1fr)"] { grid-template-columns: minmax(0, 1fr) !important; }
  /* Fila de portadas de narrativa: tres por fila */
  #dc-root [style*="grid-template-columns: repeat(6, minmax(0, 1fr))"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12px !important; }
  #dc-root [style*="grid-template-columns: repeat(6, minmax(0, 1fr))"] span[style*="font-size"] { font-size: 13px !important; }

  /* Rejillas de productos: dos por fila (mobile.js marca .cb-pgrid) */
  #dc-root .cb-pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #dc-root .cb-pgrid > * > a:first-child, #dc-root .cb-pgrid > * > button:first-child { height: 190px !important; }
  #dc-root .cb-pgrid > * > a:first-child > div { height: 190px !important; }
  #dc-root .cb-pgrid > * > a:first-child img, #dc-root .cb-pgrid > * > button:first-child img { object-fit: contain !important; padding: 8px !important; }
  #dc-root .cb-pgrid > * > div { padding: 10px !important; gap: 4px !important; }
  #dc-root .cb-pgrid > * > div span, #dc-root .cb-pgrid > * > div button { font-size: 14px !important; }
  #dc-root .cb-pgrid > * > div > span:first-child { font-size: 11px !important; }
  #dc-root .cb-pgrid [style*="justify-content: space-between"] { flex-direction: column !important; align-items: stretch !important; gap: 6px !important; }
  #dc-root .cb-pgrid [style*="justify-content: space-between"] > span { font-size: 17px !important; }
  #dc-root .cb-pgrid [style*="justify-content: space-between"] > button,
  #dc-root .cb-pgrid [style*="justify-content: space-between"] > a { width: 100% !important; box-sizing: border-box !important; justify-content: center !important; height: 40px !important; }

  /* Tarjetas de sellos de la portada (con tentáculo decorativo a la izquierda) */
  #dc-root a[style*="padding: 32px 28px 32px 120px"] { padding: 24px 20px !important; min-height: 0 !important; }
  #dc-root a[style*="padding: 32px 28px 32px 120px"] > img[style*="position: absolute"] { opacity: 0.25 !important; height: 100% !important; }

  /* Tarjetas de colecciones (Librojuegos): imagen arriba y texto debajo */
  #dc-root a[style*="padding: 32px 32px 32px 150px"] { padding: 22px 18px !important; flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; min-height: 0 !important; }
  #dc-root a[style*="padding: 32px 32px 32px 150px"] > img[style*="position: absolute"] { opacity: 0.25 !important; }
  #dc-root a[style*="padding: 32px 32px 32px 150px"] > span[style*="flex: 1 1 auto"] { width: 100% !important; }
  /* Abanico de portadas (Narrativa): más pequeño para que quepa centrado */
  #dc-root div[style*="justify-content: center; padding: 10px 0"] > img[style*="width: 150px; height: 225px"] { width: 112px !important; height: 168px !important; flex-shrink: 0 !important; }
  #dc-root div[style*="justify-content: center; padding: 10px 0"] > img[style*="margin-left: -40px"] { margin-left: -28px !important; }
  /* Imágenes decorativas posicionadas en absoluto que se salen de la pantalla */
  #dc-root img[style*="position: absolute; left: 580px"] { display: none !important; }

  /* Textos legales: tablas desplazables */
  .legal table { display: block; overflow-x: auto; }
  #dc-root article[style*="flex: 1 1 640px"] { flex-basis: 100% !important; }
  #dc-root aside[style*="position: sticky"], #dc-root nav[style*="position: sticky"] { position: static !important; }

  /* Botones a ancho completo en las cabeceras de sección */
  #dc-root section [style*="display: flex"][style*="flex-wrap: wrap"] > a[style*="height: 5"],
  #dc-root section [style*="display: flex"][style*="flex-wrap: wrap"] > button[style*="height: 5"] { flex: 1 1 100%; justify-content: center; }

  /* Cabecera compacta con menú desplegable */
  header > div[style*="max-width: 1280px"] { padding: 10px 14px !important; gap: 10px !important; flex-wrap: nowrap !important; justify-content: flex-start !important; position: relative; }
  header > div img[alt="Celaeno Books"] { height: 40px !important; }
  header nav[aria-label="Principal"] { display: none !important; }
  header.cb-open nav[aria-label="Principal"] {
    display: flex !important; flex-direction: column !important; gap: 0 !important; position: absolute; top: 100%; left: 0; right: 0; z-index: 70;
    background: #0F0E0C; border-bottom: 1px solid #2A2722; padding: 4px 16px 12px !important; font-size: 18px !important;
  }
  header.cb-open nav[aria-label="Principal"] a { padding: 12px 0; border-bottom: 1px solid #1F1D19; }
  header > div > a[href="index.html"]:first-child, header > div > a[href="/index.html"]:first-child { margin-right: auto; }
  header > div > a, header > div > button { flex: 0 0 auto; }
  header [data-cb-account], header a[href="carrito.html"] { height: 40px !important; padding: 0 10px !important; font-size: 14px !important; }
  .cb-burger { display: flex !important; }
}
.cb-burger {
  display: none; order: 99; width: 40px; height: 40px; align-items: center; justify-content: center; flex: 0 0 auto;
  background: transparent; border: 1px solid #3A362E; border-radius: 0; color: #EDE6D6; cursor: pointer; padding: 0;
}

/* Filtros de la tienda plegables en móvil */
@media (max-width: 760px) {
  .cb-filters-toggle { display: flex !important; }
  .cb-filters:not(.cb-filters-open) { display: none !important; }
}
.cb-filters-toggle {
  display: none; align-items: center; justify-content: space-between; width: 100%; height: 46px; padding: 0 14px;
  background: #181612; border: 1px solid #3A362E; border-radius: 0; color: #EDE6D6; font: inherit; font-weight: 600; cursor: pointer; box-sizing: border-box;
}
/* Submenú de Librojuegos */
.cb-dd { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.cb-dd-btn { background: none; border: none; color: inherit; padding: 4px; cursor: pointer; display: inline-flex; align-items: center; opacity: .8; }
.cb-dd-menu {
  display: none; position: absolute; top: 100%; left: -16px; z-index: 80; min-width: 260px; padding: 8px 0; margin-top: 10px;
  background: #141310; border: 1px solid #3A362E; box-shadow: 0 16px 40px rgba(0,0,0,.55); flex-direction: column;
}
.cb-dd-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.cb-dd-menu a { padding: 10px 18px; font-size: 15px; font-weight: 500; color: #EDE6D6; white-space: nowrap; }
.cb-dd-menu a:hover, .cb-dd-menu a[aria-current="page"] { background: #1F1D19; color: #3DB04A; }
.cb-dd-menu a:first-child { border-bottom: 1px solid #2A2722; margin-bottom: 4px; color: #B5AD9C; }
@media (hover: hover) and (min-width: 761px) { .cb-dd:hover .cb-dd-menu { display: flex; } }
.cb-dd.cb-dd-open .cb-dd-menu { display: flex; }
@media (max-width: 760px) {
  header.cb-open .cb-dd { display: flex; flex-direction: column; align-items: stretch; }
  header.cb-open .cb-dd > a { padding: 12px 0; border-bottom: 1px solid #1F1D19; }
  header.cb-open .cb-dd-btn { display: none; }
  header.cb-open .cb-dd-menu { display: flex; position: static; margin: 0; padding: 0 0 6px 14px; border: none; box-shadow: none; background: transparent; min-width: 0; }
  header.cb-open .cb-dd-menu a { padding: 9px 0; font-size: 16px; border-bottom: 1px solid #1F1D19; white-space: normal; }
  header.cb-open .cb-dd-menu a:first-child { display: none; }
}