/* ============================================================
   EDITOR VIEW
   ============================================================ */
.editor-view {
  height: 100vh;
  display: grid;
  grid-template-rows: 52px 1fr 36px;
  background: var(--bg);
}
.editor-view[hidden] { display: none; }

/* Top toolbar */
.ed-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}
.ed-top-left { display: flex; align-items: center; gap: 10px; }
.ed-top-center { display: flex; gap: 4px; justify-content: center; }
.ed-top-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

.home-link {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  text-decoration: none;
  transition: background 160ms ease;
}
.home-link:hover { background: var(--surface-2); }

.file-name {
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  width: 220px;
  color: var(--ink);
  outline: none;
  transition: background 160ms ease;
}
.file-name:hover, .file-name:focus { background: var(--surface-2); }

.autosave-tag {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-mute);
  padding-left: 8px;
  border-left: 1px solid var(--line);
  margin-left: 4px;
}
.autosave-tag.pending { color: var(--gold); }
.save-btn {
  width: auto;
  padding: 0 8px;
  color: var(--brand);
}
.save-btn:hover:not(:disabled) { color: var(--brand-deep); }

.tool-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, color 160ms ease;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.tool-btn span {
  font-size: 12.5px;
  font-weight: 600;
}
.tool-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}
.tool-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#teacherToggle {
  width: auto;
  padding: 0 10px;
  border: 1px solid var(--line);
}
#teacherToggle:hover { border-color: var(--brand); color: var(--brand); }

#downloadBtn {
  width: auto;
  padding: 0 14px;
  height: 34px;
  font-size: 12.5px;
}
.presentation-open-btn { width: auto; padding: 0 11px; border: 1px solid var(--line); color: var(--brand); }
.presentation-open-btn:hover { border-color: var(--brand); background: var(--brand-soft) !important; color: var(--brand) !important; }

.zoom-label {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-2);
  padding: 0 4px;
  min-width: 36px;
  text-align: center;
}

/* ============================================================
   EDITOR BODY: 3 columnas
   ============================================================ */
.ed-body {
  display: grid;
  grid-template-columns: 362px 1fr 280px;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}
.ed-body.left-panel-collapsed { grid-template-columns: 42px minmax(0, 1fr) 280px; }
.ed-body.right-panel-collapsed { grid-template-columns: 362px minmax(0, 1fr) 42px; }
.ed-body.left-panel-collapsed.right-panel-collapsed { grid-template-columns: 42px minmax(0, 1fr) 42px; }

.panel-collapse-btn {
  position: absolute;
  top: 7px;
  z-index: 25;
  width: 28px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #FFF;
  box-shadow: 0 3px 8px rgba(139,61,255,.24);
  cursor: pointer;
  font: 700 21px/1 var(--ff-ui);
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.panel-collapse-btn:hover {
  color: #FFF;
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}
.panel-collapse-left { right: 8px; }
.panel-collapse-right { left: auto; right: 8px; }
.ed-left, .ed-right { position: relative; transition: background 180ms ease; }
.ed-left-heading {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 58px 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
  font: 700 12px/1 var(--ff-ui);
  letter-spacing: .02em;
}
.ed-body.left-panel-collapsed .ed-left-tabs,
.ed-body.left-panel-collapsed .ed-left-content,
.ed-body.left-panel-collapsed .ed-left-heading,
.ed-body.right-panel-collapsed .ed-right-empty,
.ed-body.right-panel-collapsed .ed-right-panel { display: none; }
.panel-collapse-left { top: 9px; right: 16px; }
.ed-body.left-panel-collapsed .panel-collapse-left { right: 7px; }
.ed-body.right-panel-collapsed .panel-collapse-right { left: auto; right: 9px; }

/* Left sidebar */
.ed-left {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  grid-template-rows: 42px 1fr;
  min-height: 0;
}

.ed-left-tabs {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  padding: 16px 6px 12px;
  gap: 6px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.ed-tab {
  background: transparent;
  border: none;
  padding: 9px 4px;
  border-radius: 7px;
  color: var(--ink-mute);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  transition: all 160ms ease;
  border-left: 2px solid transparent;
  flex: 0 0 auto;
  min-width: 0;
}
.ed-tab svg { flex-shrink: 0; }
.ed-tab span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ed-tab:hover { color: var(--ink); background: var(--surface-2); }
.ed-tab.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-left-color: var(--brand);
}

.ed-left-content {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ed-body.left-panel-collapsed .ed-left { grid-template-columns: 1fr; }

.panel-search {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 160ms ease;
}
.panel-search:focus-within { background: #FFF; border-color: var(--brand); }
.panel-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
}

.panel-section h4 {
  font-family: var(--ff-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ink-mute);
  margin: 4px 0 8px;
}
.panel-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  text-align: left;
  font: 700 11px/1.2 var(--ff-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.panel-section-toggle:hover { color: var(--brand); }
.panel-section-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.panel-section-chevron {
  flex: none;
  color: var(--brand);
  font: 700 17px/12px var(--ff-ui);
  letter-spacing: 0;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}
.panel-accordion-section.is-collapsed { padding-bottom: 0; }
.panel-accordion-section.is-collapsed .panel-section-chevron { transform: rotate(-90deg); }
.panel-accordion-section.is-collapsed > .panel-section-content { display: none; }
.panel-section-content { min-width: 0; }
.prop-inline-palette { margin: 1px 0 10px; }

/* Elementos: shapes grid */
.shapes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.shape-thumb {
  aspect-ratio: 1/1;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 160ms ease;
}
.shape-thumb:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* Stickers grid */
.stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.sticker-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 7px;
  padding: 3px;
  border-radius: 7px;
  background: var(--surface-2);
}
.sticker-tab {
  flex: 1;
  border: 0;
  border-radius: 5px;
  padding: 6px 3px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.sticker-tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(24,24,27,.1); }
.sticker-thumb {
  aspect-ratio: 1/1;
  background: var(--surface-2);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all 160ms ease;
}
.sticker-thumb:hover {
  background: var(--brand-soft);
  transform: scale(1.05);
}
.sticker-image-thumb img { width: 76%; height: 76%; object-fit: contain; }
.other-sticker-thumb svg { width: 70%; height: 70%; color: var(--brand); }
.other-symbol-thumb { font-size: 26px; color: var(--brand); font-family: var(--ff-display); }

/* Color swatches */
.colors-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.color-swatch {
  aspect-ratio: 1/1;
  border-radius: 4px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 140ms ease;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-glow); }
.draw-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.draw-tool {
  min-width: 0;
  min-height: 52px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 6px 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  font: 600 9px/1.1 var(--ff-ui);
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.draw-tool:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.draw-tool.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); box-shadow: 0 0 0 2px var(--brand-glow); }
.draw-tool-icon { font: 22px/1 Georgia, serif; }
.draw-tool-icon-svg { display: grid; place-items: center; }
.draw-tool-icon-svg svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.draw-tool span:last-child { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.draw-control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}
.draw-control-label .color-preview { width: 26px; height: 26px; }
.draw-colors { margin-top: 7px; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.draw-width-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}
.draw-width-row input { min-width: 0; width: 100%; }
.draw-width-row output { min-width: 30px; color: var(--ink-mute); font: 10px var(--ff-mono); text-align: right; }

.uploads-library-section { padding-top: 0; }
.uploads-library-head { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-bottom:9px; }
.uploads-library-head h4 { margin-bottom:0; }
.uploads-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:7px; }
.upload-asset { min-width:0; padding:0; overflow:hidden; border:1px solid var(--line); border-radius:7px; background:var(--surface-2); color:var(--ink-2); cursor:pointer; text-align:left; transition:border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease; }
.upload-asset:hover { border-color:var(--brand); transform:translateY(-1px); box-shadow:0 3px 10px rgba(139,61,255,.14); }
.upload-asset img { display:block; width:100%; aspect-ratio:1/1; object-fit:cover; background:#fff; }
.upload-asset span { display:block; overflow:hidden; padding:5px 6px 6px; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.upload-empty { margin:0; color:var(--ink-mute); font-size:11px; line-height:1.45; }

/* Text presets */
.text-preset {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 160ms ease;
  margin-bottom: 6px;
}
.text-preset:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.text-preset .tp-preview {
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 4px;
}
.text-preset .tp-art {
  position: relative;
  height: 78px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.text-preset .tp-art.portrait { width: 54px; margin-left: auto; margin-right: auto; }
.text-preset .tp-art.landscape { height: 58px; }
.tp-art-title {
  position: relative;
  z-index: 2;
  max-width: 90%;
  font: 700 20px/0.95 Fraunces, serif;
  text-align: center;
  white-space: normal;
}
.tp-art-mark, .tp-art-line {
  position: absolute;
  display: block;
  opacity: .7;
  border-radius: 999px;
}
.tp-art-mark { width: 34px; height: 34px; right: 12px; top: 10px; background: currentColor; opacity: .18; }
.tp-art-line { width: 42%; height: 5px; left: 29%; bottom: 12px; background: currentColor; opacity: .35; }
.text-preset .tp-meta {
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--ink-mute);
}

/* ============================================================
   STAGE (centro)
   ============================================================ */
.ed-stage {
  position: relative;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(1200px 800px at 50% 50%, #ECEAE3 0%, #DDD9CE 100%);
  background-attachment: local;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 40px;
}
.stage-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(24,24,27,0.05) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}

.canvas-wrapper {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  margin: auto;
  z-index: 2;
}

.canvas-document {
  background: #FFFFFF;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.08),
    0 24px 48px rgba(0,0,0,0.16);
  position: relative;
  overflow: hidden;
}

/* Cuando el canvas está vacío */
.canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 13px;
  pointer-events: none;
}
.canvas-empty svg { color: var(--ink-soft); margin-bottom: 8px; }

/* Ventana contextual del elemento seleccionado */
.selection-popup {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 16px);
  padding: 5px;
  border: 1px solid rgba(24,24,27,.14);
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 30px rgba(24,24,27,.18), 0 2px 6px rgba(24,24,27,.1);
  backdrop-filter: blur(10px);
  transform: translateZ(0);
}
.selection-popup::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,.96);
  border-right: 1px solid rgba(24,24,27,.14);
  border-bottom: 1px solid rgba(24,24,27,.14);
  transform: translateX(-50%) rotate(45deg);
}
.selection-popup.below::after {
  top: -6px;
  bottom: auto;
  border: 0;
  border-left: 1px solid rgba(24,24,27,.14);
  border-top: 1px solid rgba(24,24,27,.14);
}
.selection-popup[hidden] { display: none; }
.selection-popup-head {
  padding: 0 6px 0 4px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
}
.selection-popup-kind {
  color: var(--ink-mute);
  font: 700 10px/1 var(--ff-ui);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.selection-popup-actions { display: flex; align-items: center; gap: 2px; }
.selection-popup-action {
  width: 29px;
  height: 29px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  box-sizing: border-box;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.selection-popup-action:hover,
.selection-popup-action.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-glow);
}
.selection-popup-action[data-selection-action="delete"] { color: var(--coral); }
.selection-popup-action[data-selection-action="delete"]:hover { background: rgba(255,107,92,.12); border-color: rgba(255,107,92,.22); }
.selection-popup-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.selection-popup-letter { font: 700 15px/1 var(--ff-ui); }
.selection-popup-letter.italic { font-style: italic; }
.selection-popup-separator { width: 1px; height: 20px; margin: 0 2px; background: var(--line); }

/* ============================================================
   ELEMENTOS EN EL CANVAS
   ============================================================ */
.ed-element {
  position: absolute;
  user-select: none;
  cursor: move;
  border: 0;
  transition: border-color 120ms ease;
}
.ed-element.dragging { cursor: grabbing; will-change: left, top; transition: none; }
.ed-element.text { display: flex; align-items: center; }
.ed-element.sticker {
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ed-element.sticker .ed-el-sticker {
  display: flex;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10%;
  align-items: center;
  justify-content: center;
  line-height: .82;
  text-align: center;
  transform: translateY(-0.02em);
}
.ed-element.sticker img.ed-el-sticker {
  display: block;
  padding: 0;
  object-fit: contain;
  transform: none;
  line-height: normal;
}
.ed-element.text .ed-el-text {
  width: 100%;
  outline: none;
  word-wrap: break-word;
  white-space: pre-wrap;
  pointer-events: none;
}
.ed-element.image {
  /* Los tiradores quedan fuera del borde del elemento; la imagen ya ocupa
     todo el contenedor y no necesita recortarlo desde el padre. */
  overflow: visible;
  background: var(--surface-2);
}
.ed-element.frame { overflow: hidden; background: repeating-conic-gradient(#f1f0f4 0 25%, #fff 0 50%) 50% / 18px 18px; border: 2px dashed #b7aec4; }
.ed-element.frame.circle { border-radius: 50%; }
.ed-element.frame.rounded { border-radius: 18%; }
.ed-element.frame.arch { border-radius: 50% 50% 10% 10%; }
.ed-element.frame .frame-placeholder { display:flex; width:100%; height:100%; align-items:center; justify-content:center; color:#6b6075; font-size:13px; font-weight:700; background:rgba(255,255,255,.58); }
.ed-element.draw { overflow: visible; }
.ed-el-drawing { width:100%; height:100%; overflow:visible; pointer-events:none; }
.draw-live-preview {
  position: absolute;
  inset: 0;
  z-index: 1000;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.canvas-guide { position:absolute; display:none; pointer-events:none; z-index:999; background:#8b3dff; opacity:.8; }
.canvas-guide.vertical { top:0; bottom:0; width:1px; }
.canvas-guide.horizontal { left:0; right:0; height:1px; }
.ed-el-image {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: move;
}
.ed-element.text.editing .ed-el-text {
  pointer-events: auto;
  cursor: text;
}
.ed-element.text.editing {
  border-color: var(--brand);
}
.ed-element.editing {
  outline: none;
}
.ed-frame-outline {
  display: block;
  box-sizing: border-box;
  pointer-events: none;
}

/* Handles de redimensión */
.ed-handles {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border: 1.5px dashed var(--brand);
  z-index: 20;
  pointer-events: none;
  display: none;
}
.ed-element.selected .ed-handles { display: block; }

.ed-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #FFF;
  border: 2px solid var(--brand);
  border-radius: 3px;
  pointer-events: auto;
  z-index: 10;
}
.ed-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.ed-handle.n  { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.ed-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.ed-handle.e  { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }
.ed-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.ed-handle.s  { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.ed-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.ed-handle.w  { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }
.ed-handle.nw, .ed-handle.ne, .ed-handle.se, .ed-handle.sw { width: 14px; height: 14px; }
.ed-handle.nw { top: -7px; left: -7px; }
.ed-handle.ne { top: -7px; right: -7px; }
.ed-handle.se { bottom: -7px; right: -7px; }
.ed-handle.sw { bottom: -7px; left: -7px; }

/* Mayús: las esquinas turquesa indican el modo de escala proporcional. */
body.aspect-lock-active .ed-element.selected .ed-handle.nw,
body.aspect-lock-active .ed-element.selected .ed-handle.ne,
body.aspect-lock-active .ed-element.selected .ed-handle.se,
body.aspect-lock-active .ed-element.selected .ed-handle.sw {
  width: 13px;
  height: 13px;
  margin: -1.5px;
  background: var(--teal);
  border-color: #087f70;
  box-shadow: 0 0 0 3px rgba(43,217,194,.22);
}
body.aspect-lock-active .ed-element.selected .ed-handle.n,
body.aspect-lock-active .ed-element.selected .ed-handle.e,
body.aspect-lock-active .ed-element.selected .ed-handle.s,
body.aspect-lock-active .ed-element.selected .ed-handle.w {
  opacity: .3;
}

/* Botón eliminar que aparece al seleccionar */
.ed-delete-btn {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #FFF;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 20;
  box-shadow: var(--shadow-2);
}
.ed-element.selected .ed-delete-btn { display: flex; }
.ed-delete-btn:hover { background: var(--coral); }

/* ============================================================
   RIGHT PANEL · Propiedades
   ============================================================ */
.ed-right {
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-gutter: stable;
  padding: 0;
}

.ed-right-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 54px 24px 32px;
  color: var(--ink-mute);
}
.ed-right-empty[hidden], .ed-right-panel[hidden] { display: none; }
.ed-right-empty p {
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--ink-2);
  max-width: 200px;
  line-height: 1.4;
}
.ed-right-empty .hint {
  font-size: 11px;
  color: var(--ink-mute);
}

.ed-right-panel {
  padding: 44px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ed-right-panel .prop-section {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.ed-right-panel .prop-section:last-child { border-bottom: 0; }
.ed-right-panel textarea,
.ed-right-panel input,
.ed-right-panel select { max-width: 100%; box-sizing: border-box; }

.prop-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ink-mute);
  margin: 0 0 7px;
}
.prop-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 0 7px;
  border: 0;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  text-align: left;
  font: 700 11px/1.2 var(--ff-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.prop-section-toggle:hover { color: var(--brand); }
.prop-section-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.prop-section-chevron {
  flex: none;
  color: var(--brand);
  font: 700 17px/12px var(--ff-ui);
  letter-spacing: 0;
  text-transform: none;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}
.accordion-section.is-collapsed { padding-bottom: 6px; }
.accordion-section.is-collapsed .prop-section-chevron { transform: rotate(-90deg); }
.accordion-section.is-collapsed > .prop-section-content { display: none; }
.prop-section-content { min-width: 0; }

.background-help { margin: -1px 0 10px; line-height: 1.45; }
.background-mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.background-mode-options button {
  display: flex;
  min-width: 0;
  min-height: 62px;
  padding: 8px 4px 7px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-mute);
  cursor: pointer;
  font: 600 10px/1.1 var(--ff-ui);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.background-mode-options button:hover,
.background-mode-options button.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}
.background-mode-options button.active { box-shadow: 0 0 0 1px var(--brand-glow); }
.background-mode-options svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.background-subsection[hidden] { display: none; }
.background-swatches { margin-top: 10px; }
.background-no-color {
  grid-column: span 2;
  aspect-ratio: auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px dashed var(--line);
  background: repeating-conic-gradient(#e4e2e8 0 25%, #fff 0 50%) 50% / 8px 8px;
  color: var(--ink-mute);
}
.background-no-color span { font-size: 16px; line-height: 1; }
.background-no-color small { font: 600 10px/1 var(--ff-ui); }
.gradient-background-preview {
  height: 72px;
  margin: 3px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.gradient-color-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gradient-color-pickers label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--ink-mute); font-size: 10px; font-weight: 700; }
.gradient-color-pickers .color-preview { width: 42px; height: 27px; flex: none; }
.gradient-angle-row { margin-top: 10px; }
.gradient-angle-row label { min-width: 52px; }
.gradient-angle-row select { flex: 1; min-width: 0; padding: 6px 7px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink-2); font: 11px var(--ff-ui); }
.gradient-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.gradient-presets button { height: 28px; padding: 0; border: 2px solid transparent; border-radius: 6px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.gradient-presets button:hover { border-color: var(--brand); transform: translateY(-1px); }
.animation-section,
.page-animation-section { display: none; }
.animation-preview-btn { width: 100%; justify-content: center; margin-top: 9px; border-color: var(--brand-glow); color: var(--brand); }
.animation-preview-btn:hover { background: var(--brand-soft); }
.animation-preview-btn.is-previewing { background: var(--brand); border-color: var(--brand); color: #fff; }
.ed-element.animation-previewing .ed-handles { border-style: solid; box-shadow: 0 0 0 4px rgba(139,61,255,.16); }
.background-image-actions { display: flex; gap: 6px; align-items: stretch; }
.background-image-actions .primary-btn { flex: 1; min-width: 0; justify-content: center; }
.background-image-remove { color: var(--coral); border-color: rgba(255,107,92,.22); background: rgba(255,107,92,.06); }
.background-image-remove:hover:not(:disabled) { color: #D94D40; border-color: rgba(255,107,92,.4); background: rgba(255,107,92,.12); }
.background-image-remove:disabled { opacity: .45; cursor: not-allowed; }
.background-image-thumbnail { display: flex; align-items: center; gap: 9px; margin-top: 9px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); }
.background-image-thumbnail img { width: 54px; height: 38px; flex: none; object-fit: cover; border-radius: 4px; border: 1px solid rgba(24,24,27,.12); }
.background-image-thumbnail span { color: var(--ink-mute); font-size: 10px; font-weight: 700; }

.prop-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  min-width: 0;
}
.prop-row label {
  font-size: 11.5px;
  color: var(--ink-mute);
  width: 50px;
}
.prop-row input[type="text"],
.prop-row input[type="number"],
.prop-row select {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 160ms ease;
}
.prop-row input:focus, .prop-row select:focus { border-color: var(--brand); }
.frame-style-row { align-items: flex-start; }
.frame-style-row > label { padding-top: 8px; }
.frame-style-options {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.frame-style-option {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 32px;
  padding: 4px 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.frame-style-option:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.frame-style-option.selected {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand-glow);
}
.frame-style-preview {
  display: block;
  width: 100%;
  height: 22px;
  position: relative;
}
.frame-style-preview::before,
.frame-style-preview::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}
.frame-style-preview::after { display: none; }
.frame-style-preview::before { top: 50%; transform: translateY(-50%); }
.frame-style-preview-none::before {
  display: none;
}
.frame-style-preview-none svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.frame-spacing-control { width: 100%; box-sizing: border-box; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.frame-spacing-heading { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: baseline; gap: 8px; margin-bottom: 8px; }
.frame-spacing-heading strong { color: var(--ink-2); font-size: 11px; }
.frame-spacing-heading span { color: var(--ink-mute); font-size: 9px; line-height: 1.25; }
.frame-spacing-grid { display: grid; gap: 6px; }
.frame-spacing-grid .slider-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 34px; align-items: center; gap: 8px; margin: 0; }
.frame-spacing-grid .slider-row label { min-width: 0; }
.frame-spacing-grid .slider-row input[type="range"] { width: 100%; min-width: 0; }
.frame-spacing-grid .slider-row .val { min-width: 0; }
.draw-same-color-row { padding: 4px 0 8px; color: var(--ink-mute); font-size: 10px; }
.draw-same-color-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.draw-same-color-row input { margin: 0; accent-color: var(--brand); }
.frame-style-preview-dashed::before {
  background: repeating-linear-gradient(to right, currentColor 0 5px, transparent 5px 8px);
}
.frame-style-preview-dotted::before {
  height: 5px;
  background: repeating-linear-gradient(to right, currentColor 0 2px, transparent 2px 6px);
}
.frame-style-preview-double::before { top: 7px; }
.frame-style-preview-double::after { top: 15px; display: block; }
.shape-stroke-color-heading { margin-top: 13px !important; padding-top: 10px; border-top: 1px solid var(--line); }
.font-sample {
  margin: 8px 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.prop-row-inline {
  display: flex;
  gap: 4px;
  min-width: 0;
  flex-wrap: wrap;
}
.prop-actions { display: flex; gap: 4px; }
.prop-row-inline button {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 140ms ease;
}
.prop-row-inline button:hover { background: var(--brand-soft); color: var(--brand); }
.prop-row-inline button.active { background: var(--brand); color: #FFF; }
.image-background-actions { margin-top: 2px; }
.image-background-actions button { flex: 1; min-width: 0; justify-content: center; }
.text-align-controls { flex-wrap: nowrap; }
.text-align-controls button { display: flex; align-items: center; justify-content: center; }
.text-align-controls svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.layer-actions { flex-wrap: nowrap; }
.layer-actions button { font-size: 10px; padding-left: 3px; padding-right: 3px; }
.align-grid { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 6px; align-items: center; }
.align-grid > span { color: var(--ink-mute); font-size: 10px; }
.align-grid .prop-row-inline { flex-wrap: nowrap; }

.color-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.color-preview {
  width: 36px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.color-preview input[type="color"] {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  border: none;
  cursor: pointer;
}
.modern-color-picker {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, var(--surface-2));
  box-shadow: 0 2px 8px rgba(24,24,27,.05);
}
.modern-color-swatch {
  position: relative;
  width: 36px;
  height: 32px;
  overflow: hidden;
  border: 1px solid rgba(24,24,27,.16);
  border-radius: 7px;
  background:
    linear-gradient(var(--picker-color), var(--picker-color)),
    repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 50% / 10px 10px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.5);
  cursor: pointer;
}
.modern-color-swatch input[type="color"] {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.modern-color-value {
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-mute);
  font: 600 11px var(--ff-mono);
}
.modern-color-value span { padding-left: 9px; }
.modern-color-value input {
  min-width: 0;
  width: 100%;
  padding: 0 8px 0 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-2);
  font: 600 11px var(--ff-mono);
  text-transform: uppercase;
}
.transparent-color-btn { width: 30px; height: 30px; flex: none; border: 1px dashed var(--line); border-radius: 6px; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 50% / 8px 8px; color: var(--ink-mute); font: 700 17px/1 var(--ff-ui); cursor: pointer; }
.transparent-color-btn:hover, .transparent-color-btn.active { border-color: var(--brand); color: var(--brand); background-color: var(--brand-soft); }
.color-eyedropper-btn {
  width: 34px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-2);
  cursor: crosshair;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.color-eyedropper-btn:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.color-eyedropper-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.canvas-eyedropper-active #canvasDocument,
body.canvas-eyedropper-active #canvasDocument * { cursor: crosshair !important; }
body.canvas-eyedropper-active #canvasDocument { box-shadow: 0 0 0 3px var(--teal), 0 24px 48px rgba(0,0,0,.16); }

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  min-width: 0;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--brand);
}
.slider-row input[type="number"] {
  width: 52px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 11px var(--ff-mono);
  text-align: center;
}
.slider-row .val {
  font-family: var(--ff-mono);
  min-width: 32px;
  text-align: right;
  color: var(--ink-2);
}

/* Layers list (capas) */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}
.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-2);
  transition: background 140ms ease;
}
.layer-item:hover { background: var(--surface-2); }
.layer-item.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.layer-item svg { color: var(--ink-mute); flex-shrink: 0; }
.layer-item.active svg { color: var(--brand); }
.layer-item .layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   BOTTOM BAR
   ============================================================ */
.ed-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-mute);
}
.page-actions { display: flex; align-items: center; gap: 6px; }
.page-name-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}
.page-nav-btn { font-size: 24px; font-family: Georgia, serif; line-height: 1; }
.page-name-input {
  width: 130px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 5px;
  color: var(--ink-2);
  font: 11px var(--ff-mono);
  padding: 5px 7px;
}
.page-name-group .page-nav-btn { border-color: transparent; background: transparent; }
.page-name-group .page-nav-btn:hover:not(:disabled) { background: var(--brand-soft); }
.page-name-input:hover, .page-name-input:focus { border-color: var(--line); background: var(--surface-2); outline: none; }
.upload-hint { margin: 10px 0 0; color: var(--ink-mute); font: 10px var(--ff-mono); }
.single-page-note {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--ff-mono);
}
.foot-left { display: flex; gap: 14px; align-items: center; }
.dim-label, .pages-count {
  font-family: var(--ff-mono);
}
.dim-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============================================================
   TEACHER PANEL (reutilizado)
   ============================================================ */
.teacher-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: #FFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  z-index: 80;
  overflow: hidden;
}
.teacher-panel[hidden] { display: none; }

.teacher-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, var(--brand-soft) 0%, #FFF 100%);
  border-bottom: 1px dashed var(--line);
}
.teacher-eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand-deep);
  font-weight: 700;
}
.teacher-title {
  font-family: var(--ff-display);
  font-size: 22px;
  margin-top: 2px;
  line-height: 1.1;
  font-weight: 600;
}
.teacher-body {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  max-height: 360px;
  overflow-y: auto;
}
.teacher-body h4 {
  font-family: var(--ff-display);
  font-size: 16px;
  margin: 14px 0 4px;
  font-weight: 600;
}
.teacher-body h4:first-child { margin-top: 0; }
.teacher-body p { margin: 0 0 10px; }
.teacher-body code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--ff-mono);
  font-size: 12px;
  color: var(--brand-deep);
}
.teacher-body ul { padding-left: 18px; margin: 6px 0 10px; }
.teacher-body li { margin-bottom: 4px; }
.teacher-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 500;
}
.teacher-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(43,217,194,0.6);
  animation: pulse 2s infinite;
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-host {
  position: fixed;
  top: 70px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #FFF;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  border-left: 3px solid var(--brand);
  animation: slideInRight 280ms cubic-bezier(.2,.7,.2,1);
  pointer-events: auto;
}
.toast.success { border-left-color: var(--teal); }
.toast.warn    { border-left-color: var(--gold); }

/* ============================================================
   MODAL DE DESCARGA
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24,24,27,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 200ms ease;
}
.modal-overlay[hidden] { display: none; }

/* Reproductor de la presentación completa */
.presentation-modal { z-index: 160; padding: 18px; background: rgba(10,10,14,.92); backdrop-filter: blur(10px); }
.presentation-card { display: grid; grid-template-rows: auto minmax(0,1fr) 3px auto; width: min(1120px, calc(100vw - 36px)); height: min(820px, calc(100vh - 36px)); overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: #17171d; box-shadow: 0 32px 90px rgba(0,0,0,.55); animation: slideUpFade 240ms cubic-bezier(.2,.7,.2,1); }
.presentation-head { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px 11px 20px; border-bottom: 1px solid rgba(255,255,255,.09); color: #fff; }
.presentation-head h3 { margin: 2px 0 0; color: #fff; font: 600 19px/1.1 var(--ff-display); }
.presentation-kicker { display: block; color: #a9a5b4; font: 700 9px/1 var(--ff-mono); letter-spacing: .13em; text-transform: uppercase; }
.presentation-head-actions { display: flex; align-items: center; gap: 10px; }
.presentation-counter { min-width: 58px; color: #bdb9c7; font: 600 11px/1 var(--ff-mono); text-align: right; }
.presentation-icon-btn, .presentation-control, .presentation-play { display: inline-grid; place-items: center; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.07); color: #fff; cursor: pointer; transition: background 140ms ease, border-color 140ms ease, transform 140ms ease; }
.presentation-icon-btn:hover, .presentation-control:hover:not(:disabled), .presentation-play:hover { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.14); transform: translateY(-1px); }
.presentation-icon-btn { width: 34px; height: 34px; border-radius: 50%; font: 300 23px/1 var(--ff-ui); }
.presentation-stage { min-height: 0; padding: 22px; overflow: hidden; background: radial-gradient(circle at 50% 42%, #31303a 0, #222129 44%, #111116 100%); }
.presentation-canvas-host { display: grid; width: 100%; height: 100%; place-items: center; overflow: hidden; }
.presentation-slide-frame { position: relative; flex: none; overflow: visible; filter: drop-shadow(0 22px 34px rgba(0,0,0,.42)); }
.presentation-canvas { position: absolute; inset: 0 auto auto 0; pointer-events: none; transform-origin: top left; box-shadow: none; }
.presentation-canvas .ed-element { pointer-events: none; }
.presentation-progress { height: 3px; overflow: hidden; background: rgba(255,255,255,.08); }
.presentation-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--brand), var(--teal)); transform-origin: left center; }
.presentation-controls { display: flex; min-height: 64px; align-items: center; justify-content: center; gap: 10px; padding: 10px 18px; color: #fff; }
.presentation-control { width: 38px; height: 38px; border-radius: 10px; font: 400 26px/1 var(--ff-ui); }
.presentation-control:disabled { opacity: .28; cursor: not-allowed; }
.presentation-play { width: 46px; height: 42px; border-color: rgba(139,61,255,.75); border-radius: 12px; background: var(--brand); font: 800 17px/1 var(--ff-ui); }
.presentation-page-name { min-width: 0; max-width: 260px; margin-left: 8px; overflow: hidden; color: #bbb7c5; font: 600 11px/1 var(--ff-ui); text-overflow: ellipsis; white-space: nowrap; }

.modal-card {
  background: #FFF;
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  width: 480px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  animation: slideUpFade 280ms cubic-bezier(.2,.7,.2,1);
}
.modal-head {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 600;
}
.modal-body {
  padding: 20px;
  text-align: center;
}
.modal-preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.modal-preview-inner {
  position: relative;
  pointer-events: none;
}
.modal-preview-inner .canvas-document {
  position: relative;
  pointer-events: none;
  box-shadow: var(--shadow-2);
}
.modal-body p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-actions .ghost-btn {
  border: 1px solid var(--line);
  background: #FFF;
}
.export-option { display:block; margin:-5px 0 14px; color:var(--ink-mute); font-size:12px; }
.workspace-card { max-width:620px; }
.folder-workspace-card { width:590px; max-width:calc(100vw - 30px); }
.folder-workspace-card .modal-head { background:linear-gradient(135deg, var(--brand-soft), #fff 70%); }
.folder-workspace-card .modal-head h3 { margin:0; }
.modal-eyebrow { display:block; margin-top:3px; color:var(--brand); font:700 10px/1 var(--ff-mono); letter-spacing:.08em; text-transform:uppercase; }
.folder-intro { margin:0 0 18px !important; color:var(--ink-2) !important; line-height:1.5; }
.folder-actions-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; text-align:left; }
.folder-action-card { display:flex; min-height:132px; padding:14px; flex-direction:column; align-items:flex-start; gap:6px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2); color:var(--ink); cursor:pointer; text-align:left; transition:border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.folder-action-card:hover { border-color:var(--brand); background:var(--brand-soft); transform:translateY(-1px); }
.folder-action-card strong { font-size:13px; }
.folder-action-card small { color:var(--ink-mute); font-size:11px; line-height:1.45; }
.folder-action-icon { display:grid; width:30px; height:30px; place-items:center; border-radius:8px; background:#fff; color:var(--brand); font-size:21px; box-shadow:var(--shadow-1); }
.folder-create-inline { margin-top:12px; padding:11px; border:1px solid var(--brand-glow); border-radius:8px; background:var(--brand-soft); text-align:left; }
.folder-create-inline label { display:block; margin-bottom:6px; color:var(--ink-2); font-size:11px; font-weight:700; }
.folder-create-inline > div { display:flex; gap:7px; }
.folder-create-inline input { min-width:0; flex:1; border:1px solid var(--line); border-radius:6px; padding:8px 9px; background:#fff; font:inherit; }
.saved-folders { margin-top:20px; text-align:left; }
.saved-folders-head { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:8px; }
.saved-folders-head span { color:var(--ink-mute); font-size:10px; }
.folder-choice { display:flex; width:100%; align-items:center; gap:9px; padding:9px; border:1px solid var(--line); border-radius:7px; background:#fff; color:var(--ink-2); cursor:pointer; text-align:left; }
.folder-choice + .folder-choice { margin-top:6px; }
.folder-choice:hover { border-color:var(--brand); background:var(--brand-soft); }
.folder-choice-icon { font-size:18px; }
.folder-choice strong, .folder-choice small { display:block; }
.folder-choice strong { font-size:12px; }
.folder-choice small { margin-top:2px; color:var(--ink-mute); font-size:10px; }
.folder-choice-select { margin-left:auto; flex:none; padding:7px 10px; }
.folder-empty, .folder-unavailable { margin:0; padding:12px; border-radius:7px; background:var(--surface-2); color:var(--ink-mute); font-size:11px; line-height:1.45; text-align:left; }
.folder-unavailable strong, .folder-unavailable span { display:block; }
.folder-unavailable strong { margin-bottom:4px; color:var(--ink-2); }
.folder-fallback-button { width:100%; justify-content:center; margin-top:10px; }
.local-workspace-btn { display:block; margin:18px auto 0; padding:5px; border:0; background:transparent; color:var(--ink-mute); cursor:pointer; font:600 11px var(--ff-ui); }
.local-workspace-btn:hover { color:var(--brand); text-decoration:underline; }
.workspace-create { display:flex; gap:8px; margin-bottom:18px; }
.workspace-create input { flex:1; border:1px solid var(--line); border-radius:6px; padding:8px; font:inherit; }
.workspace-folders { text-align:left; padding:12px 0; border-top:1px solid var(--line); }
.workspace-section-head, .workspace-projects-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.workspace-section-head .muted, .workspace-projects-head .muted { margin:0; }
.folder-browser { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.folder-chip { display:inline-flex; align-items:center; justify-content:space-between; gap:8px; margin:0; padding:7px 9px; background:var(--surface-2); border:1px solid transparent; border-radius:8px; font:600 12px/1 var(--ff-ui); color:var(--ink-2); cursor:pointer; transition:all 140ms ease; }
.folder-chip small { min-width:16px; padding:2px 4px; border-radius:999px; background:#fff; color:var(--ink-mute); font:500 10px/1 var(--ff-mono); text-align:center; }
.folder-chip:hover, .folder-chip.active { color:var(--brand); background:var(--brand-soft); border-color:var(--brand-glow); }
.workspace-projects-head { margin:18px 0 2px; text-align:left; }
.workspace-projects { max-height:310px; overflow:auto; }
.workspace-project { display:flex; justify-content:space-between; align-items:center; gap:10px; text-align:left; border-top:1px solid var(--line); padding:10px 0; }
.workspace-project small, .muted { display:block; color:var(--ink-mute); font-size:12px; margin-top:3px; }
.workspace-project-open { min-width:0; flex:1; display:flex; align-items:center; gap:9px; padding:0; border:0; background:transparent; font:inherit; text-align:left; cursor:pointer; }
.workspace-project-open:hover strong { color:var(--brand); }
.workspace-project-mark { width:30px; height:24px; flex:none; border-radius:5px; box-shadow:inset 0 0 0 1px rgba(24,24,27,.1); }
.workspace-project-open strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; transition:color 140ms ease; }
.workspace-project-actions { display:flex; align-items:center; gap:5px; }
.workspace-project select { width:125px; max-width:125px; padding:5px; border:1px solid var(--line); border-radius:5px; background:#fff; font:inherit; font-size:11px; }
.workspace-empty-filter { display:flex; flex-direction:column; align-items:center; gap:5px; padding:28px 12px; border-top:1px solid var(--line); color:var(--ink-mute); text-align:center; }
.workspace-empty-filter strong { color:var(--ink-2); font-size:13px; }
.workspace-empty-filter span:last-child { font-size:12px; }
.workspace-empty-icon { font-size:22px; opacity:.65; }
.version-row { width:100%; display:flex; justify-content:space-between; align-items:center; padding:11px; background:#fff; border:1px solid var(--line); border-radius:7px; margin-bottom:8px; font:inherit; cursor:pointer; text-align:left; }
.version-row:hover { border-color:var(--brand); background:var(--brand-pale); }
.version-row small { color:var(--ink-mute); }

/* ============================================================
   SCROLLBARS
   ============================================================ */
.ed-left-content::-webkit-scrollbar,
.ed-right::-webkit-scrollbar,
.home-view::-webkit-scrollbar { width: 8px; }
.ed-left-content::-webkit-scrollbar-track,
.ed-right::-webkit-scrollbar-track { background: transparent; }
.ed-left-content::-webkit-scrollbar-thumb,
.ed-right::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}
.home-view::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

/* Tablet: preservar las tres zonas de trabajo sin desbordar la ventana. */
@media (max-width: 900px) {
  .ed-top {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 8px;
  }
  .ed-top-center, .autosave-tag { display: none; }
  .save-btn span { display: none; }
  .ed-top-left { min-width: 0; gap: 6px; }
  .file-name { width: min(150px, 25vw); }
  #teacherToggle span { display: none; }
  #teacherToggle { width: 32px; padding: 0; justify-content: center; }
  .ed-top-right { gap: 4px; }
  #downloadBtn { padding: 0 10px; }
  .presentation-open-btn span { display: none; }
  .presentation-open-btn { width: 32px; padding: 0; justify-content: center; }
  .ed-body { grid-template-columns: 282px minmax(0, 1fr) 260px; }
  .ed-stage { padding: 28px; }
}

@media (max-width: 640px) {
  .presentation-modal { padding: 0; }
  .presentation-card { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .presentation-stage { padding: 10px; }
  .presentation-page-name { max-width: 130px; }
}

.shadow-toggle-row,
.shadow-inset-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.shadow-toggle-row button,
.shadow-inset-row button {
  flex: 1;
  padding: 6px 10px;
  font: 11px/1 var(--ff-ui);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-mute);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.shadow-toggle-row button:hover,
.shadow-inset-row button:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.shadow-toggle-row button.active,
.shadow-inset-row button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFF;
  box-shadow: 0 0 0 1px var(--brand-glow);
}
.shadow-color-preview {
  width: 36px;
  height: 28px;
}
.shadow-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}
.shadow-preset {
  padding: 6px 4px;
  font: 11px/1 var(--ff-ui);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.shadow-preset:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.shadow-preset:active {
  transform: translateY(1px);
}
