/* Coqueta Foto dentro de la web: la barra de MyPrompTribe arriba, el editor ocupando todo lo demás, el panel
   «Mis herramientas» a la derecha y la herramienta elegida encima del editor. */
html, body.cf-shell { height: 100%; }
body.cf-shell { margin: 0; padding: 0 !important; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; background: var(--bg, #0d0c15); }
body.cf-shell .tool-shell { display: contents; }
body.cf-shell .cf-shell__header { flex: none; position: relative; z-index: 5; display: flex; flex-direction: row; align-items: center; flex-wrap: nowrap !important;
  gap: 10px; min-height: 0; padding: 8px 16px; margin: 0; }
body.cf-shell .cf-shell__header .tool-header__nav { flex: 1 1 auto; width: auto !important; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
body.cf-shell .cf-shell__header .tool-header__nav::-webkit-scrollbar { display: none; }
body.cf-shell .cf-shell__header .tool-header__nav a { white-space: nowrap; }
.cf-shell__title { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; flex: none; }
.cf-shell__title img { border-radius: 6px; }

.cf-btn { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong, rgba(255, 255, 255, .18));
  background: var(--surface-2, #1d1b2a); color: inherit; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cf-btn:hover { background: var(--surface-3, #252238); border-color: rgba(139, 109, 255, .6); }
.cf-btn:focus-visible, .cf-tool:focus-visible, .cf-icon:focus-visible { outline: 2px solid var(--focus, #8ce7ff); outline-offset: 2px; }
.cf-btn--tools { background: linear-gradient(125deg, var(--action, #6552ff), #9a67f5); border-color: rgba(255, 255, 255, .14); color: #fff; box-shadow: 0 8px 22px rgba(101, 82, 255, .28); }
.cf-btn--tools:hover { filter: brightness(1.1); background: linear-gradient(125deg, var(--action, #6552ff), #9a67f5); }
.cf-btn--ghost { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }

.cf-shell__main { flex: 1; min-height: 0; display: flex; position: relative; max-width: none !important; width: 100%; margin: 0 !important; padding: 0 !important; background: var(--bg, #0d0c15); }
#cf-editor { flex: 1; width: 100%; height: 100%; border: 0; display: block; background: var(--bg, #0d0c15); }

/* panel «Mis herramientas» */
.cf-tools { position: absolute; top: 0; right: 0; bottom: 0; z-index: 3; width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 16px;
  overflow-y: auto; background: rgba(18, 17, 28, .97); border-left: 1px solid var(--border, rgba(255, 255, 255, .1)); backdrop-filter: blur(12px); box-shadow: -18px 0 40px rgba(0, 0, 0, .35);
  color: var(--text, #f7f6fb); animation: cf-in .18s ease-out; }
.cf-tools[hidden] { display: none; }
@keyframes cf-in { from { transform: translateX(24px); opacity: 0; } }
.cf-tools__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cf-tools__eyebrow { margin: 0; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink, #c1b4ff); font-weight: 700; }
.cf-tools h2 { margin: 2px 0 0; font-size: 1.25rem; }
.cf-tools__lead, .cf-tools__note { margin: 0; font-size: .86rem; line-height: 1.45; color: var(--text-soft, #c3bfd0); }
.cf-tools__note { margin-top: auto; font-size: .78rem; }
.cf-tools__status { margin: 0; min-height: 1.2em; font-size: .84rem; color: var(--cyan, #4dd8ff); }
.cf-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .15); background: transparent; color: inherit; cursor: pointer; }
.cf-icon:hover { background: rgba(255, 255, 255, .08); }
.cf-source { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.cf-source label { position: relative; cursor: pointer; }
.cf-source input { position: absolute; opacity: 0; pointer-events: none; }
.cf-source span { display: block; padding: 8px 6px; border-radius: 9px; text-align: center; font-size: .84rem; font-weight: 600; color: var(--text-soft, #c3bfd0); }
.cf-source input:checked + span { background: var(--brand-soft, rgba(139, 109, 255, .16)); color: #fff; box-shadow: inset 0 0 0 1px rgba(139, 109, 255, .5); }
.cf-source input:focus-visible + span { outline: 2px solid var(--focus, #8ce7ff); }
.cf-tools__list { display: grid; gap: 8px; }
.cf-tool { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; text-align: left;
  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .04); color: inherit; font: inherit; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.cf-tool:hover { background: var(--brand-soft, rgba(139, 109, 255, .16)); border-color: rgba(139, 109, 255, .5); transform: translateY(-1px); }
.cf-tool img { border-radius: 10px; background: rgba(255, 255, 255, .06); }
.cf-tool__text { display: grid; gap: 2px; min-width: 0; }
.cf-tool__text b { font-size: .95rem; }
.cf-tool__text small { font-size: .78rem; line-height: 1.35; color: var(--text-soft, #c3bfd0); }
.cf-tool__tag { font-size: .68rem; font-weight: 700; padding: 3px 7px; border-radius: 999px; background: var(--cyan-soft, rgba(77, 216, 255, .14)); color: var(--cyan, #4dd8ff); white-space: nowrap; }

/* la herramienta, encima del editor */
.cf-run { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; background: var(--bg, #0d0c15); }
.cf-run[hidden] { display: none; }
.cf-run__bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--surface, #171622); border-bottom: 1px solid var(--border, rgba(255, 255, 255, .1)); color: var(--text, #f7f6fb); }
.cf-run__icon { border-radius: 8px; flex: none; }
.cf-run__text { flex: 1; min-width: 0; }
.cf-run__text h2 { margin: 0; font-size: 1rem; }
.cf-run__text p { margin: 0; font-size: .8rem; color: var(--text-soft, #c3bfd0); overflow: hidden; text-overflow: ellipsis; }
#cf-run-frame { flex: 1; width: 100%; border: 0; display: block; background: var(--bg, #0d0c15); }

.cf-toast { position: absolute; left: 50%; top: 14px; z-index: 6; transform: translateX(-50%); max-width: min(520px, calc(100% - 32px)); padding: 10px 16px; border-radius: 12px;
  background: var(--surface-3, #252238); color: #fff; font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .12); }
.cf-toast[data-kind="ok"] { border-color: rgba(120, 220, 170, .55); }
.cf-toast[data-kind="error"] { border-color: rgba(255, 120, 120, .6); }
.cf-toast[hidden] { display: none; }

/* pantallas pequeñas: barra compacta; en el móvil en horizontal, aún más */
@media (max-width: 900px) { .cf-shell__title { display: none; } }
@media (max-width: 720px), (max-height: 520px) {
  body.cf-shell .cf-shell__header { padding: 4px 10px; gap: 6px; }
  body.cf-shell .cf-shell__header .brand-lockup__name { display: none; }
  body.cf-shell .cf-shell__header .brand-lockup__mark { width: 26px; height: 26px; }
  body.cf-shell .cf-shell__header .tool-header__nav { gap: 2px; }
  body.cf-shell .cf-shell__header .tool-header__nav a:not(.brand-lockup) { min-height: 32px; padding: 6px 8px; font-size: .76rem; }
  .cf-btn { padding: 6px 10px; }
  #cf-fullscreen span { display: none; }
  .cf-run__text p { display: none; }
}
@media (max-width: 480px) { .cf-btn--tools span { display: none; } .cf-tools { width: 100%; border-left: 0; } }
@media (prefers-reduced-motion: reduce) { .cf-tools { animation: none; } }

/* móvil en vertical: aviso para girarlo (el editor está pensado para pantallas anchas) */
.cf-rotate { display: none; position: absolute; left: 12px; right: 12px; top: 12px; z-index: 6; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px;
  background: rgba(29, 27, 42, .97); color: #fff; font-size: .88rem; line-height: 1.35; border: 1px solid rgba(139, 109, 255, .45); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.cf-rotate span { flex: 1; }
@media (orientation: portrait) and (max-width: 600px) { .cf-rotate { display: flex; } }
body.cf-rotate-off .cf-rotate { display: none; }
/* Coqueta Motion: el clip del proyecto que se manda a la herramienta */
.cf-source-label { font-size: .8rem; font-weight: 600; color: var(--text-soft, #c3bfd0); }
.cf-select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border-strong, rgba(255, 255, 255, .18)); background: var(--surface-2, #1d1b2a); color: var(--text, #f7f6fb); font: inherit; font-size: .86rem; }

/* Versiones del asistente: miniaturas y comparador con cortina */
.cf-versions { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; background: var(--bg, #0d0c15); color: var(--text, #f7f6fb); }
.cf-versions__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; padding: 14px; }
.cf-versions__grid { overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.cf-versions__card { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: var(--surface, #171622); }
.cf-versions__thumb { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 8px; }
.cf-versions__thumb img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 8px; background: #000; }
.cf-versions__abs { display: flex; gap: 6px; }
.cf-versions__ab { flex: 1; padding: 5px 0; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.cf-versions__card.is-left .cf-versions__ab--a { background: #8ce7ff; color: #0d0c15; border-color: #8ce7ff; }
.cf-versions__card.is-right .cf-versions__ab--b { background: #ff5fa2; color: #0d0c15; border-color: #ff5fa2; }
.cf-versions__ab:focus-visible, .cf-versions__thumb:focus-visible { outline: 2px solid var(--focus, #8ce7ff); outline-offset: 2px; }
.cf-versions__card strong { font-size: .85rem; }
.cf-versions__card small { font-size: .72rem; color: var(--text-soft, #c3bfd0); min-height: 1em; }
.cf-versions__card.is-right { border-color: #ff5fa2; }
.cf-versions__card.is-left { border-color: #8ce7ff; }
.cf-cmp { min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.cf-cmp__stage { position: relative; flex: 1; min-height: 0; border-radius: 12px; overflow: hidden; background: #000; }
.cf-cmp__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cf-cmp__right { position: absolute; inset: 0; }
.cf-cmp__handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 8px rgba(0, 0, 0, .6); pointer-events: none; }
.cf-cmp__range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.cf-cmp__bar { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; }
.cf-cmp__tag--l { color: #8ce7ff; }
.cf-cmp__tag--r { color: #ff5fa2; }
.cf-cmp__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cf-cmp__actions .cf-btn { text-decoration: none; }
.cf-cmp__hint { margin: 0; font-size: .75rem; color: var(--text-soft, #c3bfd0); }
@media (max-width: 760px) {
  .cf-versions__body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; padding: 10px 16px; }
  .cf-versions__grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 120px; overflow-x: auto; overflow-y: hidden; }
}

/* Tarjeta del asistente sobre el lienzo: entorno, concepto y pasos */
.cf-assist { position: absolute; left: 64px; bottom: 56px; z-index: 6; width: min(360px, calc(100% - 96px)); padding: 14px 16px 12px; border-radius: 16px;
  background: rgba(23, 22, 34, .92); backdrop-filter: blur(10px); color: var(--text, #f7f6fb); border: 1px solid rgba(255, 95, 162, .35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45); font-size: .82rem; pointer-events: none; }
.cf-assist[hidden] { display: none; }
.cf-assist p { margin: 0 0 4px; }
.cf-assist__title { font-weight: 800; font-size: .95rem; background: linear-gradient(90deg, #ff5fa2, #9a67f5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cf-assist__env { color: #8ce7ff; font-size: .76rem; }
.cf-assist__head { color: var(--text-soft, #c3bfd0); }
.cf-assist__steps { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 3px; }
.cf-assist__steps li { position: relative; padding-left: 22px; color: var(--text-soft, #c3bfd0); }
.cf-assist__steps li::before { content: ""; position: absolute; left: 4px; top: .45em; width: 9px; height: 9px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); }
.cf-assist__steps li[data-state="now"] { color: #fff; }
.cf-assist__steps li[data-state="now"]::before { border-color: #ff5fa2; border-top-color: transparent; animation: cf-spin .8s linear infinite; }
.cf-assist__steps li[data-state="done"] { color: #fff; }
.cf-assist__steps li[data-state="done"]::before { background: #78dcaa; border-color: #78dcaa; }
.cf-assist__steps li[data-state="error"]::before { background: #ff7878; border-color: #ff7878; }
.cf-assist__steps li[data-state="info"]::before { border-color: #8ce7ff; }
.cf-assist__bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.cf-assist__bar span { display: block; height: 100%; background: linear-gradient(90deg, #ff5fa2, #9a67f5); transition: width .4s ease; }
.cf-assist__final { margin-top: 8px !important; color: #fff; }
@keyframes cf-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cf-assist__steps li[data-state="now"]::before { animation: none; } }
@media (max-width: 760px) { .cf-assist { left: 16px; bottom: 16px; width: calc(100% - 32px); } }
