/* KlipTok Constructor · capa tipo Wix/Framer (ligera) */
:root {
  --kbs-bg: #0b1020;
  --kbs-panel: #121a2f;
  --kbs-line: rgba(148,163,184,.14);
  --kbs-text: #e2e8f0;
  --kbs-muted: #94a3b8;
  --kbs-accent: #a78bfa;
  --kbs-accent2: #38bdf8;
}
/* Barra única del constructor · estilo CLARO (el de la antigua barra #kt-studio) */
/* la barra clara antigua se oculta solo mientras esta barra única está a la vista (clase puesta por el JS) */
html.kbs-merged #kt-studio { display: none !important; }
.kbs-top {
  display: flex; align-items: center; gap: .35rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin;
  min-height: 40px; padding: 4px 10px; box-sizing: border-box;
  background: linear-gradient(90deg, rgba(37,99,235,.07), rgba(124,58,237,.07), rgba(236,72,153,.07));
  border-bottom: 1px solid var(--kt-line, rgba(128,128,160,.25));
  color: inherit;
  font: 600 12.5px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  position: sticky; top: 0; z-index: 50;
}
.kbs-top .kbs-brand {
  display: inline-flex; align-items: center; height: 30px; padding: 0 .8rem; border-radius: 999px;
  color: #fff; font-weight: 800; white-space: nowrap; margin-right: .2rem;
  background: linear-gradient(100deg, #2563eb, #7c3aed 55%, #ec4899);
}
.kbs-top .kbs-sep { width: 1px; height: 20px; background: var(--kt-line, rgba(128,128,160,.35)); margin: 0 .1rem; flex: 0 0 auto; }
.kbs-top button, .kbs-top .kbs-chip {
  appearance: none; display: inline-flex; align-items: center; gap: .3rem; height: 30px; padding: 0 .55rem;
  border-radius: 8px; border: 1px solid var(--kt-line, rgba(128,128,160,.35));
  background: var(--kt-card, rgba(255,255,255,.7)); color: inherit; font: inherit; cursor: pointer; white-space: nowrap;
}
html.dark .kbs-top button { background: rgba(255,255,255,.06); }
.kbs-top button:hover:not(:disabled) { border-color: #8b5cf6; background: rgba(124,58,237,.12); }
.kbs-top button:focus-visible { outline: 2px solid #8b5cf6; outline-offset: 1px; }
.kbs-top button.on, .kbs-top button[aria-pressed=true] { background: rgba(124,58,237,.22); border-color: #8b5cf6; }
.kbs-top button:disabled { opacity: .4; cursor: not-allowed; }
.kbs-top .kbs-pri { color: #fff; border-color: transparent; background: linear-gradient(100deg, #2563eb, #7c3aed 55%, #ec4899); font-weight: 700; }
html.dark .kbs-top .kbs-pri { background: linear-gradient(100deg, #2563eb, #7c3aed 55%, #ec4899); }
.kbs-top .kbs-pri:hover:not(:disabled) { color: #fff; filter: brightness(1.08); border-color: transparent; background: linear-gradient(100deg, #2563eb, #7c3aed 55%, #ec4899); }
.kbs-top .kbs-sp { flex: 1 1 auto; min-width: .5rem; }
.kbs-top .kbs-state { opacity: .75; white-space: nowrap; }
.kbs-top .kbs-state.dirty { color: #d97706; opacity: 1; }
.kbs-devices { display: inline-flex; gap: .15rem; padding: 0; }
.kbs-devices button { padding: 0 .5rem; }

/* Canvas stage */
.kbs-stage-wrap {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,58,237,.12), transparent 50%),
    #0b1020;
  padding: 1rem 1rem 2rem;
  min-height: 50vh;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}
.kbs-stage-meta {
  display: flex; align-items: center; gap: .75rem; color: var(--kbs-muted); font: 600 11px system-ui;
  width: min(100%, var(--kbs-w, 100%));
}
.kbs-stage {
  width: min(100%, var(--kbs-w, 1200px));
  max-width: 100%;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: 0 25px 80px -20px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  overflow: hidden;
  transition: width .25s ease;
  min-height: 480px;
}
.kbs-stage.kbs-mobile { --kbs-w: 390px; border-radius: 24px; }
.kbs-stage.kbs-tablet { --kbs-w: 768px; }
.kbs-stage.kbs-desktop { --kbs-w: 1200px; }

/* Zoom */
.kbs-zoom { display: inline-flex; align-items: center; gap: .35rem; }
.kbs-zoom output { min-width: 2.5rem; text-align: center; opacity: .75; font-variant-numeric: tabular-nums; }

/* Grid overlay helper */
.kbs-stage.kbs-grid-on .kb-page,
.kbs-stage.kbs-grid-on [data-kb-id] {
  background-image: linear-gradient(rgba(124,58,237,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,58,237,.04) 1px, transparent 1px);
  background-size: 16px 16px;
}

/* Empty state */
.kbs-empty {
  padding: 3rem 1.5rem; text-align: center; color: #64748b;
}
.kbs-empty h3 { margin: 0 0 .5rem; color: #0f172a; font-size: 1.2rem; }
.kbs-empty p { margin: 0 0 1rem; max-width: 28rem; margin-left: auto; margin-right: auto; }
.kbs-empty .kbs-hints { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.kbs-empty .kbs-hints button {
  border: 1px dashed #cbd5e1; background: #f8fafc; border-radius: 999px;
  padding: .4rem .85rem; font: 600 12px system-ui; cursor: pointer; color: #475569;
}
.kbs-empty .kbs-hints button:hover { border-color: #a78bfa; color: #6d28d9; }

/* Modal publish */
.kbs-modal-bg {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2,6,23,.65); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 1rem;
}
.kbs-modal {
  width: min(520px, 100%); background: #fff; color: #0f172a;
  border-radius: 16px; padding: 1.35rem 1.25rem; box-shadow: 0 25px 50px rgba(0,0,0,.35);
}
.kbs-modal h3 { margin: 0 0 .35rem; font-size: 1.15rem; }
.kbs-modal p { margin: 0 0 1rem; color: #64748b; font-size: .9rem; }
.kbs-modal textarea {
  width: 100%; min-height: 140px; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: .65rem; font: 12px/1.4 ui-monospace, monospace; resize: vertical;
}
.kbs-modal .row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; justify-content: flex-end; }
.kbs-modal .row button {
  border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 10px;
  padding: .5rem .9rem; font: 600 13px system-ui; cursor: pointer;
}
.kbs-modal .row button.pri { background: linear-gradient(135deg,#7c3aed,#2563eb); border: 0; color: #fff; }

/* Palette density */
.kb-pal .kb-it { max-width: 100%; }
body.kbs-studio-on .kbp { min-height: calc(100vh - 48px); }

@media (max-width: 800px) {
  .kbs-top .kbs-hide-sm { display: none; }
}
@media (max-width: 1600px) { .kbs-top button:not(.kbs-pri) .kbs-l { display: none; } }
.kbs-top > * { flex: 0 0 auto; }
.kbs-top > .kbs-sp { flex: 1 1 auto; }
