/* ==========================================================================
   ColorBook España (colorbook.es) - Estudio Colorear Online
   Ruta: style-studio.css
   Estilo editorial infantil • 100% Adaptado a pantallas táctiles y escritorio
   ========================================================================== */

/* Sub-barra de navegación y migas de pan */
.studio-subbar {
  background-color: var(--paper-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 0;
  position: relative;
  z-index: 10;
}

.studio-subbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.studio-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--sky-dark);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background-color: var(--sky-light);
  transition: var(--transition);
}

.studio-back-link:hover {
  background-color: var(--sky-blue);
  color: #FFFFFF;
}

.studio-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--slate-muted);
}

.studio-breadcrumb a {
  color: var(--slate-muted);
  font-weight: 600;
}

.studio-breadcrumb a:hover {
  color: var(--sky-blue);
}

.breadcrumb-sep {
  color: var(--slate-faint);
  font-size: 0.75rem;
}

.breadcrumb-current {
  color: var(--ink-slate);
  font-weight: 800;
}

/* ==========================================================================
   Contenedor Principal del Estudio (Stage)
   ========================================================================== */
.studio-stage-section {
  padding: 24px 0 48px;
  background-color: var(--paper-ground);
}

.studio-shell {
  background-color: var(--paper-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Barra Superior de Control del Estudio */
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background-color: var(--paper-subtle);
  border-bottom: 1.5px solid var(--border-light);
  flex-wrap: wrap;
}

.studio-drawing-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.studio-title-group {
  display: flex;
  flex-direction: column;
}

.studio-main-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink-slate);
  line-height: 1.2;
}

.studio-drawing-badge {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--sky-dark);
}

/* Botón selector de dibujo en cabecera */
.studio-select-drawing-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-light);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.studio-select-drawing-btn:hover {
  border-color: var(--sky-blue);
  color: var(--sky-blue);
  background-color: var(--sky-light);
}

/* Barra de acciones (sonido, pantalla completa, imprimir, guardar) */
.studio-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background-color: #FFFFFF;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.studio-action-btn:hover {
  background-color: var(--paper-subtle);
  border-color: var(--sky-blue);
  color: var(--sky-blue);
  transform: translateY(-1px);
}

.studio-action-btn.icon-only {
  width: 42px;
  padding: 0;
}

.studio-action-btn--primary {
  background: linear-gradient(135deg, var(--sky-blue), var(--sky-dark));
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
  padding: 0 18px;
}

.studio-action-btn--primary:hover {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
  transform: translateY(-2px);
}

.studio-action-btn--print {
  background-color: #FEF9C3;
  color: #854D0E;
  border-color: #FDE047;
}

.studio-action-btn--print:hover {
  background-color: var(--sun-yellow);
  color: var(--ink-slate);
  border-color: var(--sun-yellow);
}

/* ==========================================================================
   Espacio Creativo (Lienzo Easel + Barra de Herramientas)
   ========================================================================== */
.studio-creative-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: 640px;
  background-color: #F1F5F9;
}

/* Lienzo / Caballete */
.studio-canvas-easel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #FFFFFF 0%, #E2E8F0 100%);
}

.studio-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1 / 1.414; /* Proporción estándar A4 */
  background-color: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  border: 3px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

#studioCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* Cursor dinámico según herramienta */
.studio-canvas-wrapper.tool-bucket #studioCanvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230284C7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m19 11-8-8-8.5 8.5a2.12 2.12 0 0 0 0 3l8.5 8.5a2.12 2.12 0 0 0 3 0L19 17'/%3E%3Cpath d='m5 7 9 9'/%3E%3Cpath d='M19 11v6a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M22 20a2 2 0 1 1-4 0c0-1.6 2-3 2-3s2 1.4 2 3z' fill='%230284C7'/%3E%3C/svg%3E") 4 20, auto;
}

.studio-canvas-wrapper.tool-brush #studioCanvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230284C7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08'/%3E%3Cpath d='M7.07 14.94c-1.66 0-3 1.34-3 3 0 1.5 1.5 2.5 3 2.5 2 0 3.5-1.5 3.5-3.5 0-.55-.45-1-1-1a1 1 0 0 0-1 1c0 .5-.5 1-1 1-.5 0-1-.5-1-1 0-.83.67-1.5 1.5-1.5.55 0 1-.45 1-1s-.45-1-1-1z' fill='%230284C7'/%3E%3C/svg%3E") 2 22, crosshair;
}

.studio-canvas-wrapper.tool-eraser #studioCanvas {
  cursor: cell;
}

.studio-canvas-wrapper.tool-marker #studioCanvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230284C7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19l7-7 3 3-7 7-3-3z'/%3E%3Cpath d='M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z' fill='%230284C7'/%3E%3C/svg%3E") 2 22, crosshair;
}

.studio-canvas-wrapper.tool-picker #studioCanvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%230284C7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 22 1-1h3l9-9'/%3E%3Cpath d='M19 11l-4-4'/%3E%3Cpath d='m15 4 2-2c1-1 2.5-1 3.5 0s1 2.5 0 3.5l-2 2' fill='%230284C7'/%3E%3C/svg%3E") 2 22, copy;
}

/* Barra Flotante de Zoom en el Caballete */
.studio-zoom-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-slate);
  cursor: pointer;
  background: none;
  border: none;
  transition: var(--transition);
}

.zoom-btn:hover {
  background-color: var(--sky-light);
  color: var(--sky-blue);
}

.zoom-btn:active {
  transform: scale(0.92);
}

.zoom-btn--reset {
  width: auto;
  padding: 0 8px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--slate-muted);
}

/* Pista o consejo inferior del caballete */
.studio-canvas-hint {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-muted);
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

/* ==========================================================================
   Panel Lateral de Herramientas y Paleta de Colores (Dock)
   ========================================================================== */
.studio-tools-dock {
  background-color: var(--paper-surface);
  border-left: 1.5px solid var(--border-light);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.dock-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dock-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Botones de Modos de Dibujo: Bote, Pincel, Goma */
.tool-modes-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tool-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background-color: var(--paper-subtle);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.tool-mode-btn svg {
  color: var(--slate-muted);
  transition: var(--transition);
}

.tool-mode-btn:hover {
  background-color: var(--sky-light);
  border-color: var(--sky-blue);
  color: var(--sky-blue);
}

.tool-mode-btn.active {
  background: linear-gradient(135deg, var(--sky-blue), var(--sky-dark));
  border-color: var(--sky-blue);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.tool-mode-btn.active svg {
  color: #FFFFFF;
}

/* Selector de grosor para pincel y goma */
.brush-sizes-wrap {
  display: none;
  background-color: var(--paper-subtle);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brush-sizes-wrap.show {
  display: flex;
}

.brush-size-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1.5px solid transparent;
  color: var(--slate-muted);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.brush-size-dot {
  border-radius: 50%;
  background-color: currentColor;
}

.brush-size-dot.dot-small { width: 6px; height: 6px; }
.brush-size-dot.dot-medium { width: 10px; height: 10px; }
.brush-size-dot.dot-large { width: 15px; height: 15px; }
.brush-size-dot.dot-maxi { width: 20px; height: 20px; }

.brush-size-btn:hover {
  background-color: #FFFFFF;
  color: var(--sky-blue);
}

.brush-size-btn.active {
  background-color: #FFFFFF;
  border-color: var(--sky-blue);
  color: var(--sky-blue);
  box-shadow: var(--shadow-sm);
}

/* Botones de Historial: Deshacer, Rehacer, Borrar */
.history-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.history-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background-color: #FFFFFF;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.history-btn:hover:not(:disabled) {
  background-color: var(--sky-light);
  border-color: var(--sky-blue);
  color: var(--sky-blue);
}

.history-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--border-light);
}

.history-btn--reset {
  color: var(--coral-dark);
}

.history-btn--reset:hover:not(:disabled) {
  background-color: var(--coral-light);
  border-color: var(--coral-terracotta);
  color: var(--coral-dark);
}

/* ==========================================================================
   Paleta de Colores (20 Colores Mágicos Infantiles)
   ========================================================================== */
.palette-active-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--paper-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.active-color-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.active-color-swatch-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1.5px var(--border-light);
}

.active-color-name {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink-slate);
}

.palette-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.swatch-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  position: relative;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
  outline: none;
}

.swatch-btn:hover {
  transform: scale(1.15);
  z-index: 5;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.swatch-btn.active {
  transform: scale(1.12);
  border-color: #FFFFFF;
  box-shadow: 0 0 0 3px var(--sky-blue), 0 6px 16px rgba(14, 165, 233, 0.4);
  z-index: 6;
}

.swatch-btn.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Cajón Desplegable de Selección de Dibujos (Drawings Drawer Modal)
   ========================================================================== */
.studio-drawings-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.studio-drawings-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.studio-drawings-drawer {
  background-color: var(--paper-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-drawings-drawer-backdrop.open .studio-drawings-drawer {
  transform: scale(1);
}

.drawer-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1.5px solid var(--border-light);
  background-color: var(--paper-subtle);
}

.drawer-heading-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink-slate);
}

.drawer-heading-sub {
  font-size: 0.8rem;
  color: var(--slate-muted);
}

.drawer-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-muted);
  cursor: pointer;
  transition: var(--transition);
}

.drawer-close-btn:hover {
  background-color: #E2E8F0;
  color: var(--ink-slate);
}

/* Filtros por Categoría en el Modal */
.drawer-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1.5px solid var(--border-light);
  background-color: var(--paper-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.drawer-filter-chips::-webkit-scrollbar {
  display: none;
}

.drawer-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background-color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.drawer-chip:hover {
  color: var(--sky-blue);
  border-color: var(--sky-blue);
}

.drawer-chip.active {
  background-color: var(--sky-blue);
  color: #FFFFFF;
  border-color: var(--sky-blue);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.drawer-drawings-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  overflow-y: auto;
}

.drawing-card-btn {
  background-color: var(--paper-ground);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.drawing-card-btn:hover {
  border-color: var(--sky-blue);
  background-color: var(--sky-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.drawing-card-btn.active {
  border-color: var(--sky-blue);
  background-color: var(--sky-light);
  box-shadow: 0 0 0 2px var(--sky-blue);
}

.drawing-card-preview-box {
  width: 100%;
  aspect-ratio: 1 / 1.414; /* Proporción estándar A4 */
  background-color: #FFFFFF;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.04);
}

.drawing-thumb-canvas,
.drawing-thumb-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.drawing-card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.drawing-card-category {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--slate-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.drawing-card-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-slate);
  line-height: 1.25;
}

/* Notificación Toast del Estudio */
.studio-toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: var(--ink-slate);
  color: #FFFFFF;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  z-index: 5000;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  white-space: nowrap;
}

.studio-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Lienzo de Confetti para Celebración
   ========================================================================== */
#studioConfettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4000;
  width: 100vw;
  height: 100vh;
}

/* ==========================================================================
   Modal de Confirmación de Borrado
   ========================================================================== */
.reset-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.reset-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.reset-modal-card {
  background-color: var(--paper-surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.reset-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--coral-light);
  color: var(--coral-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.reset-modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink-slate);
  margin-bottom: 8px;
}

.reset-modal-desc {
  font-size: 0.92rem;
  color: var(--slate-muted);
  line-height: 1.5;
  margin-bottom: 22px;
}

.reset-modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.reset-modal-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.reset-modal-btn--cancel {
  background-color: var(--paper-subtle);
  color: var(--slate-muted);
  border: 1px solid var(--border-light);
}

.reset-modal-btn--confirm {
  background-color: var(--coral-dark);
  color: #FFFFFF;
}

/* ==========================================================================
   Secciones Educativas y Guía de Uso Inferior (SEO)
   ========================================================================== */
.studio-guide-section {
  padding: 60px 0;
  background-color: #FFFFFF;
  border-top: 1px solid var(--border-light);
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 36px;
}

.guide-step-card {
  background-color: var(--paper-ground);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.guide-step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sky-blue), var(--sky-dark));
  color: #FFFFFF;
  font-weight: 800;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.guide-step-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-slate);
  margin-bottom: 6px;
}

.guide-step-desc {
  font-size: 0.88rem;
  color: var(--slate-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Responsive Adaptations & Zero-Scroll Mobile Studio Architecture
   ========================================================================== */
.mobile-only-item {
  display: none;
}

@media (min-width: 769px) {
  .desktop-hidden-inline {
    display: none;
  }
}

@media (max-width: 992px) {
  .studio-creative-workspace {
    grid-template-columns: 1fr;
  }

  .studio-tools-dock {
    border-left: none;
    border-top: 1.5px solid var(--border-light);
  }

  .palette-swatches-grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .drawer-drawings-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .guide-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* 1. Ocultar la barra inferior de navegación global para no consumir 62px de pantalla */
  body.studio-page-body .mobile-bottom-nav {
    display: none !important;
  }
  body.studio-page-body {
    padding-bottom: 0 !important;
  }

  /* 2. Ocultar sub-barra para ganar 40px de espacio vertical */
  .desktop-only-subbar,
  .studio-subbar {
    display: none !important;
  }

  /* 3. Ocultar botones no esenciales en móvil */
  .desktop-only-btn {
    display: none !important;
  }

  .mobile-only-item {
    display: flex;
  }

  .studio-mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--paper-subtle);
    border: 1px solid var(--border-light);
    color: var(--slate-muted);
    flex-shrink: 0;
    transition: var(--transition);
  }

  .studio-mobile-back-btn:active {
    background-color: var(--sky-blue);
    color: #FFFFFF;
  }

  /* 4. Contenedor del estudio */
  .studio-stage-section {
    padding: 0 0 16px;
    background-color: var(--paper-surface);
  }

  .studio-stage-section .container {
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
  }

  .studio-shell {
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }

  /* 5. Barra Superior Compacta (Cambiar Dibujo + Deshacer + Rehacer + Sonido + Guardar) */
  .studio-topbar {
    padding: 6px 10px;
    height: 46px;
    gap: 6px;
    border-bottom: 1px solid var(--border-light);
    background-color: #FFFFFF;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
  }

  .studio-drawing-info {
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .studio-title-group {
    display: none; /* Oculto en móvil para dar espacio al selector de láminas */
  }

  .studio-select-drawing-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    height: 34px;
    gap: 5px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 145px;
  }

  .studio-select-drawing-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }

  .studio-actions-group {
    gap: 5px;
    flex-shrink: 0;
  }

  .studio-action-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-full);
  }

  .studio-action-btn.icon-only {
    width: 34px;
    height: 34px;
    padding: 0;
  }

  .studio-action-btn svg {
    width: 16px;
    height: 16px;
  }

  .studio-action-btn--primary {
    padding: 0 12px;
    font-weight: 800;
  }

  /* 6. Espacio Creativo Vertical adaptado a la altura de la pantalla */
  .studio-creative-workspace {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background-color: var(--paper-ground);
  }

  /* 7. Caballete con Lienzo auto-escalable sin desbordar */
  .studio-canvas-easel {
    padding: 8px 6px;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
  }

  .studio-canvas-wrapper {
    /* Altura calculada dinámicamente para garantizar cero scroll en cualquier móvil */
    height: min(54vh, calc(100dvh - 210px));
    max-height: calc(100dvh - 210px);
    width: auto;
    aspect-ratio: 1 / 1.414;
    max-width: 100%;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    border: 2px solid #FFFFFF;
    border-radius: var(--radius-md);
    margin: 0 auto;
    touch-action: none;
  }

  .studio-canvas-hint {
    display: none; /* Oculto en móvil para dar máxima altura al lienzo */
  }

  /* 8. Muelle de Herramientas convertido en Barra de Control Inferior */
  .studio-tools-dock {
    border-left: none;
    border-top: 1.5px solid var(--border-light);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background-color: #FFFFFF;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.07);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    overflow: visible;
  }

  .dock-section-title {
    display: none; /* Oculto en móvil para mantener la interfaz despejada */
  }

  /* Fila 1: Selección de Modos (Bote, Pincel, Marcador, Goma, Gotero, Limpiar) */
  .dock-section--tools {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
  }

  .tool-modes-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 2px;
    width: 100%;
  }

  .tool-modes-group::-webkit-scrollbar {
    display: none;
  }

  .tool-mode-btn {
    flex: 0 0 auto;
    flex-direction: row;
    padding: 6px 12px;
    height: 36px;
    font-size: 0.78rem;
    gap: 5px;
    border-radius: var(--radius-full);
    white-space: nowrap;
  }

  .tool-mode-btn svg {
    width: 16px;
    height: 16px;
  }

  .tool-mode-btn--reset {
    flex: 0 0 auto;
    color: var(--coral-dark);
    padding: 6px 12px;
    border-color: var(--coral-light);
    background-color: #FFF5F5;
  }

  .tool-mode-btn--reset:active {
    background-color: var(--coral-light);
  }

  /* Selector de grosores para móvil */
  .brush-sizes-wrap {
    padding: 3px 6px;
    height: 34px;
    border-radius: var(--radius-full);
    gap: 4px;
  }

  .brush-size-btn {
    padding: 4px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .studio-zoom-bar {
    top: 8px;
    right: 8px;
    padding: 2px 4px;
  }

  .zoom-btn {
    width: 26px;
    height: 26px;
  }

  /* Ocultar sección de historial del dock (deshacer/rehacer están en la cabecera) */
  .dock-section:nth-child(2) {
    display: none;
  }

  /* Fila 2: Carrusel Horizontal de 20 Colores Mágicos */
  .dock-section:nth-child(3) {
    margin: 0;
    gap: 0;
  }

  .palette-active-preview {
    display: none; /* Oculto en móvil para ahorrar espacio vertical */
  }

  .palette-swatches-grid {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 2px;
    width: 100%;
  }

  .palette-swatches-grid::-webkit-scrollbar {
    display: none;
  }

  .swatch-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }

  .swatch-btn.active {
    transform: scale(1.18);
  }

  /* Cuadrícula de láminas en el modal */
  .drawer-drawings-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
    gap: 12px;
  }

  /* Guía pedagógica inferior */
  .studio-guide-section {
    padding: 40px 16px;
  }

  .guide-steps-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Dispositivos muy pequeños (< 400px, ej. iPhone SE / Galaxy S) */
@media (max-width: 400px) {
  .studio-select-drawing-btn {
    max-width: 115px;
    font-size: 0.74rem;
    padding: 4px 8px;
  }

  .studio-action-btn--primary span {
    display: none; /* En pantallas ultra-estrechas, solo icono */
  }

  .studio-action-btn--primary {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tool-mode-btn span {
    font-size: 0.72rem;
  }

  .swatch-btn {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
  }

  .studio-canvas-wrapper {
    height: min(52vh, calc(100dvh - 200px));
  }
}

/* Utilidad de accesibilidad y SEO para encabezados y lectores de pantalla */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
