/* ============================================================
   NexusMente Studio — sistema visual
   Paleta y tipografías tomadas de nexusmente.com
   ============================================================ */

:root {
  --bg: #050910;
  --bg-soft: #060e18;
  --surface: #07101d;
  --panel: #081422;
  --navy: #0b1630;
  --teal: #20b49d;
  --bright: #31d5b8;
  --mint: #f3f7fa;
  --muted: #9baec2;
  --muted-2: #6f8499;
  --line: rgba(184, 241, 231, 0.12);
  --line-strong: rgba(184, 241, 231, 0.24);
  --danger: #ff7a7a;
  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

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

body {
  overflow: hidden;
  background:
    radial-gradient(1000px 600px at 78% -10%, rgba(32, 180, 157, 0.09), transparent 60%),
    radial-gradient(800px 500px at 8% 110%, rgba(49, 213, 184, 0.05), transparent 60%),
    var(--bg);
  color: var(--mint);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
button { color: inherit; }
img { max-width: 100%; }

::selection { background: rgba(49, 213, 184, 0.35); color: #fff; }

:focus-visible {
  outline: 2px solid var(--bright);
  outline-offset: 2px;
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(184, 241, 231, 0.18) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(184, 241, 231, 0.16); border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(184, 241, 231, 0.28); }

/* ============================== Topbar ============================== */

.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 16, 0.82);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(49, 213, 184, 0.28);
  border-radius: 11px;
  background:
    radial-gradient(circle at 30% 15%, rgba(49, 213, 184, 0.2), transparent 60%),
    var(--navy);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.brand-badge img { width: 19px; height: 21px; object-fit: contain; }

.brand-word {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.brand-word span {
  color: var(--bright);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 99px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.save-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(32, 180, 157, 0.12);
}

.save-state.is-saving { color: var(--muted); }
.save-state.is-saving i { animation: pulse 1s infinite; }
.save-state.is-error { color: #ffb3b3; border-color: rgba(255, 122, 122, 0.3); background: rgba(255, 122, 122, 0.06); }
.save-state.is-error i { background: var(--danger); box-shadow: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.topbar-title {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.project-name {
  width: min(360px, 100%);
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--mint);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
}

.project-name:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.025); }
.project-name:focus { border-color: var(--line-strong); background: var(--surface); outline: none; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.history-btns {
  display: flex;
  gap: 2px;
  padding-right: 8px;
  margin-right: 2px;
  border-right: 1px solid var(--line);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s, opacity 0.16s;
}

.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover:not(:disabled) { color: var(--mint); background: rgba(184, 241, 231, 0.07); border-color: var(--line); }
.icon-btn:disabled { opacity: 0.28; cursor: default; }

.help-btn {
  border-color: var(--line);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--mint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s, color 0.18s;
}

.btn svg { width: 15px; height: 15px; }
.btn.ghost { border-color: var(--line); background: rgba(184, 241, 231, 0.035); }
.btn.ghost:hover { border-color: var(--line-strong); background: rgba(184, 241, 231, 0.08); }
.btn.primary {
  background: var(--teal);
  color: #04110e;
  box-shadow: 0 8px 24px rgba(32, 180, 157, 0.22);
}
.btn.primary:hover { background: var(--bright); transform: translateY(-1px); box-shadow: 0 12px 30px rgba(49, 213, 184, 0.3); }
.btn.primary svg { width: 13px; height: 13px; transition: transform 0.2s; }
.btn.primary.is-open svg { transform: rotate(180deg); }
.btn.subtle {
  border-color: var(--line);
  background: rgba(184, 241, 231, 0.03);
  color: var(--mint);
}
.btn.subtle:hover { border-color: rgba(49, 213, 184, 0.4); background: rgba(32, 180, 157, 0.1); color: var(--bright); }
.btn.full { width: 100%; }
.btn:active { transform: translateY(0) scale(0.99); }

.export-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: 252px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #0a1726;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
  animation: menuIn 0.16s ease-out;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.menu button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--mint);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.menu button:hover { background: rgba(184, 241, 231, 0.07); }
.menu button span { font-size: 12px; font-weight: 700; }
.menu button small { color: var(--muted-2); font-size: 10.5px; }
.menu-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* ============================== Workspace ============================== */

.workspace {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 304px;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
}

.panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(8, 20, 34, 0.92), rgba(6, 14, 24, 0.96));
}

.panel-left { border-right: 1px solid var(--line); }
.panel-right { border-left: 1px solid var(--line); }
.panel-inner { padding: 18px 16px 28px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--bright);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.panel-close { display: none; }

.panel-section {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mint);
}

.tiny { color: var(--muted-2); font-size: 9.5px; font-weight: 600; white-space: nowrap; }

/* Format list */
.format-list { display: grid; gap: 7px; }

.format-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--mint);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}

.format-btn:hover { border-color: var(--line-strong); background: rgba(184, 241, 231, 0.05); }
.format-btn.is-active {
  border-color: rgba(49, 213, 184, 0.48);
  background: rgba(32, 180, 157, 0.09);
  box-shadow: inset 0 0 0 1px rgba(49, 213, 184, 0.12);
}

.fmt-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050d17;
}

.fmt-icon i {
  display: block;
  border: 1.5px solid var(--muted);
  border-radius: 2px;
  background: linear-gradient(145deg, rgba(32, 180, 157, 0.25), rgba(11, 22, 48, 0.6));
  transition: border-color 0.18s;
}

.format-btn.is-active .fmt-icon { border-color: rgba(49, 213, 184, 0.4); }
.format-btn.is-active .fmt-icon i { border-color: var(--bright); }

.fmt-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fmt-text b { font-size: 11.5px; font-weight: 700; }
.fmt-text small { color: var(--muted-2); font-size: 9.5px; font-weight: 600; }

/* Template grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-btn {
  display: block;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}

.template-btn:hover { border-color: rgba(49, 213, 184, 0.45); transform: translateY(-2px); background: rgba(32, 180, 157, 0.06); }
.template-btn canvas { display: block; width: 100%; height: auto; border-radius: 6px; background: #050910; }
.template-btn span {
  display: block;
  padding: 6px 3px 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.template-btn:hover span { color: var(--mint); }

/* Add elements */
.add-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }

.add-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.add-btn:hover { border-color: rgba(49, 213, 184, 0.45); background: rgba(32, 180, 157, 0.07); }

.add-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: rgba(184, 241, 231, 0.06);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
}

.add-icon svg { width: 15px; height: 15px; }
.add-icon img { width: 13px; height: 15px; object-fit: contain; }
.text-icon { color: var(--bright); font-size: 13px; }
.quote-icon { padding-top: 7px; color: var(--bright); font-family: var(--font-serif); font-size: 24px; line-height: 0; }

/* Brand */
.brand-section { padding-bottom: 8px; }

.brand-lockup {
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(circle at 78% 15%, rgba(32, 180, 157, 0.16), transparent 50%),
    linear-gradient(145deg, #071120, #050b14);
}

.brand-lockup::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(184, 241, 231, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 241, 231, 0.035) 1px, transparent 1px);
  background-size: 18px 18px;
}

.brand-lockup img { position: relative; z-index: 1; width: 134px; height: auto; }

.brand-copy {
  margin: 10px 0;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
}

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

.swatch {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.swatch:hover { transform: scale(1.15); box-shadow: 0 0 0 2px rgba(49, 213, 184, 0.5); }
.swatch:active { transform: scale(1.02); }

.brand-hint { margin: 8px 0 0; color: var(--muted-2); font-size: 9.5px; line-height: 1.5; }

/* ============================== Stage ============================== */

.stage-col {
  position: relative;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background-color: #050a11;
  background-image:
    radial-gradient(900px 500px at 50% 40%, rgba(32, 180, 157, 0.045), transparent 65%),
    radial-gradient(rgba(184, 241, 231, 0.075) 1px, transparent 1px);
  background-size: auto, 22px 22px;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 16, 0.55);
  backdrop-filter: blur(12px);
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 6px; }
.toolbar-right { justify-content: flex-end; }

.stage-meta {
  flex: 1;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.tool svg { width: 14px; height: 14px; }
.tool:hover { color: var(--mint); background: rgba(184, 241, 231, 0.06); }
.tool.is-active { color: var(--bright); border-color: rgba(49, 213, 184, 0.35); background: rgba(32, 180, 157, 0.1); }
.tool.icon-only { width: 28px; padding: 0; justify-content: center; font-size: 15px; }

.zoom-group {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.zoom-group .tool { border-radius: 0; height: 28px; }

.zoom-label {
  min-width: 46px;
  height: 28px;
  padding: 0 4px;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.zoom-label:hover { color: var(--mint); background: rgba(184, 241, 231, 0.05); }

.panel-toggle { display: none; }

/* Canvas area */
.stage-scroll {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 0;
  padding: 26px;
  overflow: auto;
}

.stage-wrap {
  position: relative;
  flex: 0 0 auto;
  margin: auto;
  border-radius: 3px;
  background: #050910;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(184, 241, 231, 0.14),
    0 0 90px rgba(32, 180, 157, 0.06);
}

.slide {
  position: relative;
  overflow: hidden;
  transform-origin: top left;
  background: #050910;
  user-select: none;
  touch-action: none;
}

.slide canvas.bg-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.el {
  position: absolute;
  box-sizing: border-box;
  cursor: grab;
  z-index: 2;
}

.el:active { cursor: grabbing; }
.el-text { white-space: pre-wrap; word-break: break-word; }
.el-image { background-repeat: no-repeat; background-position: center; }
.el.editing {
  cursor: text;
  user-select: text;
  outline: none;
  z-index: 30;
}
.el.editing::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px dashed rgba(49, 213, 184, 0.7);
  pointer-events: none;
}

/* Selection overlay (inline sizes are updated by JS to stay constant on screen) */
.selection {
  position: absolute;
  z-index: 60;
  border: 2px solid var(--bright);
  box-shadow: 0 0 0 1px rgba(5, 9, 16, 0.45), 0 0 18px rgba(49, 213, 184, 0.25);
  pointer-events: none;
}

.selection-label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  padding: 3px 6px;
  border-radius: 4px 4px 4px 0;
  background: var(--bright);
  color: #04110e;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.selection-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  transform: translate(50%, 50%);
  border: 2px solid #04110e;
  border-radius: 50%;
  background: var(--bright);
  box-shadow: 0 0 0 1px rgba(49, 213, 184, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  cursor: nwse-resize;
}

.guide {
  position: absolute;
  z-index: 55;
  pointer-events: none;
  background: var(--bright);
  box-shadow: 0 0 8px rgba(49, 213, 184, 0.8);
}

.guide-v { top: 0; bottom: 0; width: 1px; }
.guide-h { left: 0; right: 0; height: 1px; }

.safe-zones {
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}

.safe-zone-box {
  position: absolute;
  border: 1px dashed rgba(49, 213, 184, 0.65);
  border-radius: 2px;
}

.safe-zone-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(5, 9, 16, 0.72);
  color: var(--bright);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

/* Slide strip */
.slide-strip {
  padding: 10px 16px 12px;
  border-top: 1px solid var(--line);
  background: rgba(6, 14, 24, 0.9);
}

.strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.strip-title {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.strip-title b {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 9px;
}

.strip-hint { color: rgba(155, 174, 194, 0.55); font-size: 9px; }

.strip-body { display: flex; align-items: center; gap: 8px; min-width: 0; }

.slides {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.slide-thumb {
  position: relative;
  flex: 0 0 auto;
  height: 74px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #0b1630;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
}

.slide-thumb canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.slide-thumb:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.slide-thumb.is-active {
  border-color: var(--bright);
  box-shadow: 0 0 0 1px rgba(49, 213, 184, 0.35), 0 8px 22px rgba(32, 180, 157, 0.16);
}
.slide-thumb.is-dragging { opacity: 0.4; }
.slide-thumb.drop-before::before,
.slide-thumb.drop-after::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bright);
  box-shadow: 0 0 8px rgba(49, 213, 184, 0.8);
}
.slide-thumb.drop-before::before { left: -5px; }
.slide-thumb.drop-after::after { right: -5px; }

.thumb-index {
  position: absolute;
  top: 3px;
  left: 3px;
  display: grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(5, 9, 16, 0.68);
  color: var(--mint);
  font-size: 8px;
  font-weight: 800;
  backdrop-filter: blur(3px);
}

.thumb-actions {
  position: absolute;
  top: 3px;
  right: 3px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.slide-thumb:hover .thumb-actions,
.slide-thumb.is-active .thumb-actions { opacity: 1; }

.thumb-actions button {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(5, 9, 16, 0.78);
  color: var(--mint);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(3px);
}

.thumb-actions button:hover { background: var(--teal); color: #04110e; }
.thumb-actions button[data-act="delete"]:hover { background: var(--danger); color: #1a0505; }

.add-slide {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 74px;
  padding: 0;
  border: 1px dashed rgba(184, 241, 231, 0.22);
  border-radius: 8px;
  background: rgba(184, 241, 231, 0.025);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.16s, color 0.16s, background 0.16s;
}

.add-slide span { font-size: 22px; font-weight: 300; line-height: 1; }
.add-slide:hover { border-color: var(--bright); color: var(--bright); background: rgba(32, 180, 157, 0.08); }

/* ============================== Inspector ============================== */

#inspector { display: grid; gap: 0; }

.inspector-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.inspector-section:first-child { padding-top: 0; }
.inspector-section:last-child { border-bottom: 0; padding-bottom: 0; }

.inspector-section > h3,
.inspector-section .section-head h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.inspector-section .section-head { margin-bottom: 9px; }

.selected-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.selected-type {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(184, 241, 231, 0.045);
  color: var(--bright);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.selected-meta { min-width: 0; }
.selected-meta b { display: block; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.selected-meta small { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9.5px; }

.mini-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 13px;
}

.mini-btn {
  display: grid;
  place-items: center;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:hover { color: var(--mint); border-color: var(--line-strong); background: rgba(184, 241, 231, 0.06); }
.mini-btn.danger:hover { color: var(--danger); border-color: rgba(255, 122, 122, 0.4); background: rgba(255, 122, 122, 0.07); }

.prop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.prop-grid.cols-1 { grid-template-columns: 1fr; }
.prop-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field { display: grid; gap: 4px; min-width: 0; }
.field > label { color: var(--muted-2); font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; }

.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #060f1a;
  color: var(--mint);
  font-size: 11px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}

.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(49, 213, 184, 0.55); outline: none; background: #071320; }

.select { appearance: none; padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='m1 1 4 4 4-4' stroke='%239BAEC2' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }

.textarea {
  height: auto;
  min-height: 72px;
  padding: 8px;
  line-height: 1.45;
  resize: vertical;
}

.input[type="color"] {
  padding: 3px;
  cursor: pointer;
}
.input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }

input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.segmented {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #060f1a;
}

.segmented button {
  flex: 1;
  height: 29px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--mint); background: rgba(184, 241, 231, 0.05); }
.segmented button.is-active { background: rgba(32, 180, 157, 0.16); color: var(--bright); }

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.check-row input { width: 14px; height: 14px; margin: 0; accent-color: var(--teal); }

.range-row { display: flex; align-items: center; gap: 8px; }
.range-row output { min-width: 34px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }

.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 11px;
}

.bg-preset {
  position: relative;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.16s, transform 0.16s;
}

.bg-preset:hover { transform: translateY(-1px); border-color: rgba(184, 241, 231, 0.3); }
.bg-preset.is-active { border-color: var(--bright); box-shadow: 0 0 0 1px rgba(49, 213, 184, 0.25); }
.bg-preset span {
  position: absolute;
  left: 5px;
  bottom: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(5, 9, 16, 0.5);
  color: rgba(255, 255, 255, 0.82);
  font-size: 7.5px;
  font-weight: 700;
  backdrop-filter: blur(3px);
}

.divider-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 11px 0 8px;
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.empty-note {
  padding: 11px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.55;
}

/* Layers */
.layers { display: grid; gap: 3px; }

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.layer-row:hover { background: rgba(184, 241, 231, 0.05); color: var(--mint); }
.layer-row.is-active { border-color: rgba(49, 213, 184, 0.3); background: rgba(32, 180, 157, 0.09); color: var(--mint); }
.layer-row.is-hidden { opacity: 0.45; }

.layer-icon {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  border-radius: 5px;
  background: rgba(184, 241, 231, 0.06);
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
}

.layer-name { flex: 1; overflow: hidden; font-size: 10.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

.layer-eye {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}

.layer-eye:hover { background: rgba(184, 241, 231, 0.08); color: var(--mint); }
.layer-eye svg { width: 13px; height: 13px; }

.shortcuts-card {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(32, 180, 157, 0.07), rgba(11, 22, 48, 0.35));
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

.shortcuts-card b { color: var(--mint); }
.shortcuts-card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(5, 9, 16, 0.5);
  color: var(--mint);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

/* ============================== Toasts / modal / boot ============================== */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 340px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  background: rgba(9, 23, 38, 0.96);
  color: var(--mint);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  animation: toastIn 0.22s ease-out;
}

.toast::before {
  content: "✓";
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(32, 180, 157, 0.16);
  color: var(--bright);
  font-size: 9px;
  font-weight: 800;
}

.toast.is-error { border-left-color: var(--danger); }
.toast.is-error::before { content: "!"; background: rgba(255, 122, 122, 0.14); color: var(--danger); }
.toast.is-hiding { animation: toastOut 0.2s ease-in forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 5, 9, 0.72);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.18s ease-out;
}

.modal-backdrop[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(480px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #081422;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 19px; letter-spacing: -0.03em; }
.modal-body { padding: 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.modal-body h3 { margin: 0 0 8px; color: var(--mint); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.modal-body h3:not(:first-child) { margin-top: 18px; }

.shortcut-list { display: grid; gap: 7px; }
.shortcut-list .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 5px 0; border-bottom: 1px solid rgba(184, 241, 231, 0.06); }
.shortcut-list .row:last-child { border-bottom: 0; }
.shortcut-list .keys { display: flex; gap: 4px; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(32, 180, 157, 0.08), transparent 60%),
    #050910;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.boot.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot img { width: 190px; height: auto; }
.boot p { margin: 0; color: var(--muted-2); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }

.boot-bar {
  width: 150px;
  height: 2px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(184, 241, 231, 0.12);
}

.boot-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--bright);
  animation: bootSlide 1.1s ease-in-out infinite;
}

@keyframes bootSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(360%); }
}

/* ============================== Responsive ============================== */

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 264px minmax(0, 1fr) 288px; }
  .panel-inner { padding-left: 13px; padding-right: 13px; }
  .save-state { display: none; }
  .brand-word { font-size: 15px; }
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 240px minmax(0, 1fr) 268px; }
  .stage-meta { display: none; }
  .template-grid { gap: 6px; }
  .brand-word span { display: none; }
  .history-btns { padding-right: 4px; margin-right: 0; }
  .toolbar-right .tool:not(.icon-only):not(.panel-toggle):not(#safeBtn) svg { display: none; }
}

@media (max-width: 920px) {
  .workspace { display: block; }
  .stage-col { height: calc(100vh - var(--topbar-h)); }
  .panel {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    z-index: 70;
    width: min(320px, 88vw);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .panel-left { left: 0; transform: translateX(-104%); border-right: 1px solid var(--line-strong); }
  .panel-right { right: 0; transform: translateX(104%); border-left: 1px solid var(--line-strong); }
  .panel.is-open { transform: translateX(0); }
  .panel-close { display: inline-grid; }
  .panel-toggle { display: inline-flex; }
  .topbar-title { display: none; }
  .topbar { gap: 8px; }
  .topbar-brand { flex: 1; min-width: 0; }
  .topbar-actions { gap: 5px; }
  .history-btns { display: none; }
  .btn.ghost { display: none; }
  .stage-scroll { padding: 18px; }
  .strip-hint { display: none; }
  .toolbar-left .tool { padding: 0 8px; }
  .toolbar-right .tool#safeBtn { width: 30px; padding: 0; justify-content: center; font-size: 0; }
  .toolbar-right .tool#safeBtn svg { width: 15px; height: 15px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 60px; }
  .topbar { padding: 0 10px; }
  .brand-badge { width: 32px; height: 32px; border-radius: 9px; }
  .brand-badge img { width: 17px; }
  .brand-word { font-size: 13.5px; }
  .topbar-actions .btn.primary { height: 34px; padding: 0 10px; font-size: 11px; gap: 5px; }
  .topbar-actions .btn.primary svg { width: 12px; height: 12px; }
  .stage-toolbar { padding: 0 8px; gap: 6px; }
  .toolbar-right { gap: 3px; }
  .stage-scroll { padding: 12px; }
  .slide-strip { padding: 8px 10px 10px; }
  .slide-thumb { height: 62px; }
  .add-slide { height: 62px; width: 40px; }
  .strip-head { margin-bottom: 6px; }
  .tool { font-size: 9.5px; }
  .zoom-label { min-width: 40px; }
  .export-wrap .menu { position: fixed; top: calc(var(--topbar-h) + 6px); right: 10px; left: 10px; width: auto; }
  .toasts { right: 10px; left: 10px; bottom: 10px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
