/**
 * Skin Factory Studio — Layout maestro (módulo autónomo)
 */

@import url('../../Shared/Brand/css/sf-brand-tokens.css');
@import url('../../Shared/Brand/css/sf-corp-header.css');

/* —— Tokens layout Studio —— */
:root {
  --sf-split-rail: 36%;
  --sf-split-stage: 64%;
  --sf-split-handle: 5px;
  --sf-split-preview-row: 100%;
  --sf-split-bottom-row: 0%;

  --sf-layout-tool-strip-w: 48px;
  --sf-layout-tool-btn-size: 40px;
  --sf-layout-tool-btn-radius: 10px;

  --sf-layout-ticker-font-size: 0.68rem;
  --sf-layout-ticker-label-size: 0.55rem;
  --sf-layout-footer-padding: 0.35rem 0.85rem;
  --sf-layout-footer-copy-size: 0.62rem;

  --sf-layout-chat-fab-size: 3.5rem;
  --sf-layout-chat-fab-offset: 1rem;
  --sf-layout-chat-fab-z: 9998;
  --sf-layout-zoom-slider-w: 88px;
  --sf-layout-zoom-clearance-r: 5.5rem;

  --sf-layout-viewport-h: 100dvh;
  --sf-layout-stage-padding: 0.25rem 0.75rem 0.35rem;
  --sf-layout-preview-hero-radius: 18px;

  /* Móvil Studio */
  --sf-mobile-header-h: 48px;
  --sf-mobile-control-bar-h: 44px;
  --sf-mobile-tabs-h: 48px;
  --sf-mobile-canvas-ratio: 614 / 1024;
  --sf-mobile-canvas-pad-x: 3px;
  --sf-mobile-canvas-min-h: 34svh;
  --sf-mobile-canvas-max-h: 46svh;
}

/* —— Reset mínimo —— */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* —— Banda raíz: header + shell + footer —— */
body.ll-body.ll-studio-page {
  color-scheme: dark;
  background: var(--sf-bg-deep);
  color: #e8e8ec;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  min-height: var(--sf-layout-viewport-h);
}

/* Topbar: Shared/Brand/css/sf-corp-header.css */

.sf-skeleton-line {
  height: 0.55rem;
  border-radius: 4px;
  background: rgba(0, 229, 255, 0.15);
}

.sf-skeleton-line--md {
  width: min(280px, 40vw);
}

.sf-skeleton-line--sm {
  width: min(140px, 25vw);
}

/* Chrome meta: sf-corp-header.css */

/* —— BANDA 2: Shell — grid desktop (canvas a la derecha) —— */
.sf-studio-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 48px var(--sf-split-rail) var(--sf-split-handle) minmax(0, var(--sf-split-stage));
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "tools rail handle stage";
  gap: 0;
  overflow: hidden;
  height: 100%;
}

.sf-studio-bottom-panel {
  display: contents;
}

.sf-tool-strip {
  grid-area: tools;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.35rem;
  background: var(--sf-bg-deep);
  border-right: 1px solid rgba(0, 229, 255, 0.18);
  min-height: 0;
  overflow-y: auto;
}

.sf-tool-strip-label {
  display: none;
}

.sf-studio-rail {
  grid-area: rail;
}

.sf-split-col-handle {
  grid-area: handle;
}

.sf-studio-stage {
  grid-area: stage;
}

.sf-tool-strip-btn[hidden] {
  display: none !important;
}

.sf-tool-strip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sf-layout-tool-btn-size);
  height: var(--sf-layout-tool-btn-size);
  border-radius: var(--sf-layout-tool-btn-radius);
  border: 1px solid rgba(0, 229, 255, 0.2);
  background: rgba(0, 0, 0, 0.55);
  color: var(--sf-text-dim);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.sf-tool-strip-btn:hover,
.sf-tool-strip-btn.is-active {
  border-color: rgba(0, 229, 255, 0.65);
  color: #e8e8ec;
  background: rgba(0, 229, 255, 0.14);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.sf-tool-strip-icon {
  flex-shrink: 0;
}

.sf-tool-strip-icon--lg {
  width: 28px;
  height: 28px;
}

/* Col 2 — Sidebar unificado (scroll único) */
.sf-studio-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: var(--sf-bg-deep);
  overflow: hidden;
}

.sf-rail-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem 0.65rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.sf-rail-block--fondo-hub {
  margin-bottom: 0.65rem;
}

.sf-fondo-technical-block {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 229, 255, 0.22);
}

.sf-studio-panels {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sf-studio-panel {
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  background: rgba(0, 229, 255, 0.04);
}

.sf-rail-zone-label {
  margin: 0 0 0.35rem;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sf-accent);
}

.sf-rail-zone-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--sf-text-muted);
  line-height: 1.4;
}

/* Col 3 — SplitHandle */
.sf-split-col-handle {
  width: var(--sf-split-handle);
  cursor: col-resize;
  touch-action: none;
  background: rgba(56, 189, 248, 0.06);
  border-left: 1px solid rgba(56, 189, 248, 0.12);
  border-right: 1px solid rgba(56, 189, 248, 0.12);
  transition: background 0.12s ease;
  z-index: 30;
}

.sf-split-col-handle:hover {
  background: rgba(0, 229, 255, 0.38);
}

/* Col 4 — WorkspaceCanvasContainer */
.sf-studio-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--sf-bg-deep);
  overflow: hidden;
  padding: var(--sf-layout-stage-padding);
  gap: 0;
}

.sf-stage-preview-zone {
  grid-row: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
}

.sf-preview-hero {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-radius: 0;
  border: none;
  background: #000;
  box-shadow: none;
  overflow: hidden;
}

.sf-preview-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  background: #000;
}

.sf-preview-viewport:active {
  cursor: grabbing;
}

.sf-preview-pan {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.sf-preview-viewport.is-panning {
  cursor: grabbing;
}

.sf-preview-scale-shell {
  flex-shrink: 0;
  aspect-ratio: 1024 / 614;
  min-width: 0;
  min-height: 0;
  will-change: width, height;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none;
  transform-origin: center center;
  background: #000;
}

.sf-creator-preview-stage,
.sf-preview-hero__canvas,
#sf-preview-canvas {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex: 0 0 auto;
  display: block;
  position: relative;
  overflow: hidden;
  background: #000;
}

.sf-preview-empty {
  background:
    radial-gradient(ellipse 60% 45% at 50% 50%, rgba(0, 229, 255, 0.06) 0%, transparent 70%);
}

.sf-canvas-loader {
  position: relative;
  width: 56px;
  height: 56px;
}

.sf-canvas-loader__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 229, 255, 0.12);
  border-top-color: #00e5ff;
  border-right-color: rgba(0, 229, 255, 0.55);
  box-shadow:
    0 0 20px rgba(0, 229, 255, 0.35),
    inset 0 0 12px rgba(0, 229, 255, 0.08);
  animation: sf-loader-spin 0.95s cubic-bezier(0.45, 0.05, 0.25, 0.95) infinite;
}

.sf-canvas-loader__pulse {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.7) 0%, rgba(0, 229, 255, 0) 72%);
  animation: sf-loader-pulse 1.8s ease-in-out infinite;
}

@keyframes sf-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sf-loader-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

/* —— Preloader premium (paridad Creator) —— */
.sf-canvas-preloader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: auto;
  pointer-events: none;
}

.sf-canvas-preloader[hidden] {
  display: none !important;
}

.sf-canvas-preloader__stage {
  position: relative;
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sf-canvas-preloader__scan {
  position: absolute;
  inset: -6px;
  border-radius: 24px;
  overflow: hidden;
  z-index: 0;
}

.sf-canvas-preloader__scan::before {
  content: '';
  position: absolute;
  inset: -130%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 265deg,
    rgba(0, 229, 255, 0.12) 288deg,
    #00e5ff 318deg,
    #00e5ff 342deg,
    rgba(0, 229, 255, 0.2) 360deg
  );
  animation: sf-preloader-scan-rotate 2.4s linear infinite;
  filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.55));
}

.sf-canvas-preloader__scan::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 18px;
  background: rgba(5, 10, 22, 0.9);
  box-shadow:
    inset 0 0 28px rgba(0, 229, 255, 0.1),
    0 0 32px rgba(0, 229, 255, 0.08);
}

.sf-canvas-preloader__sello {
  position: relative;
  z-index: 1;
  width: 104px;
  height: 104px;
  object-fit: contain;
  filter: brightness(0) invert(1) drop-shadow(0 0 12px rgba(0, 229, 255, 0.45));
  animation: sf-preloader-sello-breathe 2.2s ease-in-out infinite;
}

.sf-canvas-preloader__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
}

.sf-canvas-preloader.is-processing .sf-canvas-preloader__label {
  color: #00e5ff;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}

#sf-layer-stack-host {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  transform: none;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto;
  z-index: 2;
  background: transparent !important;
  pointer-events: none;
  visibility: visible;
}

#sf-layer-stack-host[hidden] {
  display: none !important;
}

.sf-layer-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  opacity: 1;
  visibility: visible;
  background: transparent !important;
  pointer-events: none;
  border-radius: 0;
  filter: none !important;
  mix-blend-mode: normal;
}

.sf-layer-canvas--troquel {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.sf-layer-canvas--buttons {
  z-index: 50 !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  isolation: isolate;
}

.sf-layer-canvas--watermark {
  z-index: 60 !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  filter: none !important;
  isolation: isolate;
}

.sf-layer-canvas--buttons,
.sf-layer-canvas--watermark,
.sf-layer-canvas--troquel {
  background: transparent !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}

.sf-layer-canvas.is-hidden {
  opacity: 0 !important;
  display: none !important;
  visibility: hidden;
}

#sf-preview-composite {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  max-width: calc(100% - 1.5rem);
  max-height: calc(100% - 1.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  z-index: 2;
}

#sf-preview-composite[hidden] {
  display: none !important;
}

@keyframes sf-preloader-scan-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sf-preloader-sello-breathe {
  0%,
  100% {
    filter: brightness(0) invert(1) drop-shadow(0 0 8px rgba(0, 229, 255, 0.35));
    transform: scale(0.96);
  }

  50% {
    filter: brightness(0) invert(1) drop-shadow(0 0 24px rgba(0, 229, 255, 0.8));
    transform: scale(1);
  }
}

.sf-split-row-handle--hidden,
.sf-stage-bottom-zone--collapsed {
  display: none !important;
}

.sf-stage-bottom-zone {
  flex-shrink: 0;
  border-top: 1px solid rgba(0, 229, 255, 0.18);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(6, 6, 8, 0.92));
  padding: 0.55rem 0.75rem 0.65rem;
  min-height: 5.5rem;
}

.sf-ai-gallery-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.sf-ai-gallery-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sf-ai-gallery-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.sf-ai-gallery-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  padding: 0 0.3rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.2);
  color: #e8e8ec;
  font-size: 0.55rem;
}

.sf-ai-gallery-hint {
  font-size: 0.58rem;
  color: #64748b;
}

.sf-ai-gallery-empty {
  margin: 0;
  font-size: 0.62rem;
  color: #64748b;
}

.sf-ai-gallery-empty[hidden] {
  display: none !important;
}

.sf-ai-gallery-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.sf-ai-gallery-strip::-webkit-scrollbar {
  height: 6px;
}

.sf-ai-gallery-strip::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.35);
  border-radius: 999px;
}

.sf-layer-canvas--client-work {
  z-index: 20 !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  mix-blend-mode: normal !important;
}

.sf-ai-gallery-item {
  flex: 0 0 auto;
  width: 5.5rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.28rem;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  font-family: inherit;
  color: inherit;
}

.sf-ai-gallery-item:hover {
  border-color: rgba(0, 229, 255, 0.55);
  transform: translateY(-1px);
}

.sf-ai-gallery-item.is-active {
  border-color: rgba(0, 229, 255, 0.75);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.2);
}

.sf-ai-gallery-item.is-mounted::after {
  content: '✓';
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.92);
  color: #042f1a;
  font-size: 0.62rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sf-ai-gallery-item {
  position: relative;
}

.sf-ai-gallery-item img {
  width: 100%;
  height: 3.2rem;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: #111;
  pointer-events: none;
}

.sf-ai-gallery-mount {
  position: absolute;
  left: 50%;
  top: 1.35rem;
  transform: translate(-50%, -50%);
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.92);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.sf-ai-gallery-item:hover .sf-ai-gallery-mount,
.sf-ai-gallery-item.is-active .sf-ai-gallery-mount {
  opacity: 1;
}

.sf-ai-gallery-mount:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(0, 229, 255, 1);
}

.sf-ai-gallery-download {
  position: absolute;
  top: 0.2rem;
  left: 0.25rem;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.12s, background 0.12s;
  z-index: 3;
}

.sf-ai-gallery-item:hover .sf-ai-gallery-download,
.sf-ai-gallery-item.is-active .sf-ai-gallery-download {
  opacity: 1;
}

.sf-ai-gallery-download:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.92);
}

.sf-ai-gallery-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.5rem;
  color: #94a3b8;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sf-ai-gallery-item--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 4.2rem;
  cursor: default;
}

.sf-ai-gallery-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 229, 255, 0.2);
  border-top-color: #00e5ff;
  animation: sf-ai-spin 0.8s linear infinite;
}

@keyframes sf-ai-spin {
  to { transform: rotate(360deg); }
}

/* —— BANDA 3: Footer —— */
.sf-footer,
.sf-corp-footer,
.ll-footer-studio {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: var(--sf-layout-footer-padding);
  min-height: auto;
  border-top: 1px solid rgba(56, 189, 248, 0.12);
  background: var(--sf-bg-deep);
}

/* TickerBar */
.sf-status-ticker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  padding: 0.15rem 0;
}

.sf-status-ticker-label {
  flex-shrink: 0;
  font-size: var(--sf-layout-ticker-label-size);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sf-accent);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.1);
}

.sf-status-ticker-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.sf-status-ticker-track {
  position: relative;
  min-height: 1.2rem;
}

.sf-status-ticker-line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--sf-layout-ticker-font-size);
  font-weight: 600;
  color: var(--sf-text-muted);
}

.sf-status-ticker-line.is-active {
  opacity: 1;
}

/* Zoom — clearance para Chat FAB */
.sf-preview-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  color: var(--sf-text-muted);
  white-space: nowrap;
}

.sf-preview-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.sf-preview-zoom-btn,
.sf-preview-fit-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #e8e8ec;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
}

.sf-preview-zoom-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sf-preview-zoom-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sf-preview-zoom--footer {
  margin-left: auto;
  margin-right: var(--sf-layout-zoom-clearance-r);
  flex-shrink: 0;
}

/* —— Barra zoom (móvil fija + desktop junto al footer) —— */
.sf-studio-control-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-top: 1px solid rgba(56, 189, 248, 0.12);
  background: var(--sf-bg-deep);
  z-index: 40;
}

.sf-preview-zoom--mobile-bar {
  flex: 1;
  min-width: 0;
  margin-right: 0;
}

.sf-preview-zoom--mobile-bar input[type="range"] {
  width: min(120px, 28vw);
  accent-color: var(--sf-accent);
}

.sf-chat-fab-inline {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(135deg, #00e5ff 0%, #7c3aed 100%);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.35);
}

.sf-preview-zoom--footer input[type="range"] {
  width: var(--sf-layout-zoom-slider-w);
  accent-color: var(--sf-accent);
}

.sf-preview-zoom-val {
  min-width: 2.5rem;
  font-variant-numeric: tabular-nums;
}

.sf-footer-copy {
  width: 100%;
  text-align: center;
  font-size: var(--sf-layout-footer-copy-size);
  color: #475569;
}

/* —— UtilityOverlay: Chat FAB —— */
#sf-chat-fab,
.sf-chat-fab {
  position: fixed;
  right: var(--sf-layout-chat-fab-offset);
  bottom: var(--sf-layout-chat-fab-offset);
  z-index: var(--sf-layout-chat-fab-z);
  width: var(--sf-layout-chat-fab-size);
  height: var(--sf-layout-chat-fab-size);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  background: linear-gradient(135deg, #00e5ff 0%, #7c3aed 100%);
  box-shadow: 0 8px 28px rgba(0, 229, 255, 0.35);
  transition: transform 0.15s ease;
}

#sf-chat-fab:hover {
  transform: scale(1.05);
}

#sf-chat-fab:active {
  transform: scale(0.95);
}

/* —— Etiquetas de depuración del armazón (solo skeleton) —— */
.sf-layout-debug-tag {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0, 229, 255, 0.85);
  background: rgba(0, 0, 0, 0.55);
  border: 1px dashed rgba(0, 229, 255, 0.35);
  pointer-events: none;
  z-index: 5;
}

/* ═══════════════════════════════════════════════════════════════
   STUDIO MÓVIL — Canvas fijo arriba · herramientas scroll abajo
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  body.ll-body.ll-studio-page {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body.ll-studio-page .sf-studio-shell {
    flex: 1 1 auto;
  }

  body.ll-studio-page .sf-studio-control-bar {
    flex-shrink: 0;
  }

  /* Header compacto */
  body.ll-studio-page .sf-corp-header,
  body.ll-studio-page header.ll-topbar.sf-corp-header {
    min-height: var(--sf-mobile-header-h);
    max-height: var(--sf-mobile-header-h);
    height: var(--sf-mobile-header-h);
    padding: 0 0.5rem;
    gap: 0.35rem;
  }

  body.ll-studio-page .ll-brand-lockup--hero {
    padding: 0.15rem 0.45rem 0.15rem 0.25rem;
    border-radius: 10px;
  }

  body.ll-studio-page .ll-brand-sello {
    width: 36px !important;
    height: 36px !important;
  }

  body.ll-studio-page .ll-brand-texto {
    width: 96px !important;
    max-width: 96px !important;
  }

  body.ll-studio-page .ll-brand-lab {
    font-size: 0.52rem;
    padding: 0.12rem 0.3rem;
    white-space: nowrap;
  }

  body.ll-studio-page .sf-corp-header-center {
    display: none;
  }

  body.ll-studio-page .ll-version-badge,
  body.ll-studio-page .sf-manual-btn {
    display: none;
  }

  body.ll-studio-page .sf-studio-action-row {
    margin-right: 0;
    gap: 0.3rem;
  }

  body.ll-studio-page .sf-action-btn {
    padding: 0.38rem 0.55rem;
    font-size: 0.62rem;
  }

  /* Shell: columna — canvas fijo + panel scroll */
  .sf-studio-shell {
    display: flex;
    flex-direction: column;
    grid-template-areas: none;
    grid-template-columns: none;
    overflow: hidden;
    min-height: 0;
  }

  .sf-split-col-handle {
    display: none !important;
  }

  /* Canvas superior — ancho casi completo, skin horizontal grande */
  .sf-studio-stage {
    flex: 0 0 auto;
    order: 1;
    width: 100%;
    min-height: 0;
    --sf-mobile-skin-w: calc(100vw - (var(--sf-mobile-canvas-pad-x) * 2));
    --sf-mobile-skin-h: calc(var(--sf-mobile-skin-w) * 614 / 1024);
    height: clamp(
      var(--sf-mobile-canvas-min-h),
      calc(var(--sf-mobile-skin-h) + 6px),
      min(
        var(--sf-mobile-canvas-max-h),
        calc(
          100svh
          - var(--sf-mobile-header-h)
          - var(--sf-mobile-control-bar-h)
          - var(--sf-mobile-tabs-h)
          - env(safe-area-inset-bottom, 0px)
          - 72px
        )
      )
    );
    padding: 0.1rem var(--sf-mobile-canvas-pad-x) 0.12rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 20;
    background: var(--sf-bg-deep);
    border-bottom: 1px solid rgba(0, 229, 255, 0.22);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
  }

  .sf-stage-preview-zone,
  .sf-preview-hero {
    flex: 1;
    min-height: 0;
    height: 100%;
    border-radius: 0;
    background: #000;
  }

  .sf-preview-hero {
    gap: 0;
    border: none;
    box-shadow: none;
  }

  .sf-preview-viewport {
    height: 100%;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .sf-preview-pan {
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  /* Skin fit-to-width — aspect-ratio sin max-height para que iOS Safari respete la proporción */
  .sf-preview-scale-shell {
    width: var(--sf-mobile-skin-w);
    max-width: 100%;
    height: auto;
    aspect-ratio: 1024 / 614;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Panel inferior scrollable */
  .sf-studio-bottom-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    order: 2;
    min-height: 0;
    overflow: hidden;
    background: var(--sf-bg-deep);
  }

  /* Tabs horizontales (ex barra lateral) */
  .sf-tool-strip {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.35rem 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.22);
    background: rgba(0, 0, 0, 0.45);
    scrollbar-width: none;
  }

  .sf-tool-strip::-webkit-scrollbar {
    display: none;
  }

  .sf-tool-strip-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 3.1rem;
    height: auto;
    min-height: 2.65rem;
    padding: 0.3rem 0.35rem;
    flex-direction: column;
    gap: 0.15rem;
  }

  .sf-tool-strip-label {
    display: block;
    font-size: 0.48rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    color: inherit;
  }

  .sf-tool-strip-icon--lg {
    width: 22px;
    height: 22px;
  }

  /* Rail — scroll vertical de herramientas */
  .sf-studio-rail {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }

  .sf-rail-body {
    padding: 0.45rem 0.55rem 1rem;
  }

  /* Paletas compactas 2–3 columnas */
  .sf-palette-premium-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.3rem !important;
  }

  .sf-palette-swatch-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .sf-studio-panel {
    padding: 0.5rem;
  }

  .sf-magic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Control bar fija abajo */
  .sf-studio-control-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: var(--sf-mobile-control-bar-h);
    padding: 0.3rem 0.5rem;
    padding-bottom: max(0.3rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 229, 255, 0.28);
    background: rgba(6, 8, 12, 0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  }

  .sf-chat-fab-inline {
    display: inline-flex;
  }

  #sf-chat-fab.sf-chat-fab {
    display: none;
  }

  #sf-chat-panel {
    bottom: calc(var(--sf-mobile-control-bar-h) + 0.5rem + env(safe-area-inset-bottom));
    right: 0.5rem;
    width: min(360px, calc(100vw - 1rem));
  }

  /* Footer minimal — solo ticker opcional oculto */
  .sf-footer.ll-footer-studio {
    display: none;
  }

  .sf-layout-debug-tag {
    display: none !important;
  }

  /* Menos GPU en móvil — evita crash del tab */
  .sf-canvas-preloader__scan::before,
  .sf-canvas-preloader__sello {
    animation: none !important;
  }

  .sf-canvas-loader__ring,
  .sf-canvas-loader__pulse {
    animation-duration: 1.4s;
  }
}

@media (min-width: 769px) {
  .sf-studio-control-bar {
    justify-content: flex-end;
    padding-right: calc(var(--sf-layout-zoom-clearance-r) + 0.25rem);
  }

  .sf-chat-fab-inline {
    display: none;
  }

  /* Desktop Mac: zoom en barra inferior, sin duplicar espacio del shell */
  body.ll-studio-page .sf-studio-shell {
    flex: 1 1 auto;
    min-height: 0;
  }
}

@media (max-width: 380px) {
  .sf-palette-premium-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.ll-studio-page .ll-brand-texto {
    width: 80px !important;
    max-width: 80px !important;
  }
}

/* —— Créditos IA (header) —— */
.sf-header-credits-mount[hidden] {
  display: none !important;
}

.sf-header-credits-mount {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

.sf-studio-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.1);
  color: #00D4FF;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sf-studio-credits-badge--guest {
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.sf-studio-credits-badge--guest:hover {
  border-color: rgba(0, 212, 255, 0.65);
  background: rgba(10, 132, 255, 0.18);
}

.sf-studio-credits-badge--low {
  border-color: rgba(255, 120, 80, 0.45);
  background: rgba(255, 80, 60, 0.12);
  color: #fca5a5;
}
