/* ==========================================================================
   CodeForge Studio — Hoja de Estilos Principal
   ========================================================================== */

:root {
  --bg-app: #000000;
  --bg-surface: #000000;
  --bg-elevated: #050505;
  --bg-header: #000000;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(99, 102, 241, 0.6);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.16);

  --html-color: #f97316;
  --css-color: #38bdf8;
  --js-color: #facc15;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --topbar-height: 56px;
  --editor-font-size: 14px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #262626 #000000;
}

/* Barras de desplazamiento (Scrollbars) con fondo negro y barra gris oscura */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background-color: #000000;
}

::-webkit-scrollbar-track {
  background-color: #000000;
}

::-webkit-scrollbar-thumb {
  background-color: #262626;
  border-radius: 999px;
  border: 2px solid #000000;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #3f3f46;
}

::-webkit-scrollbar-corner {
  background-color: #000000;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

/* ==================== BARRA SUPERIOR ==================== */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  user-select: none;
  z-index: 20;
}

.topbar-left,
.topbar-center,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.pen-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pen-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pen-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  width: 220px;
  transition: all 0.15s ease;
}

.pen-title-input:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pen-title-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--accent);
}

.edit-icon {
  color: var(--text-dim);
  font-size: 12px;
  pointer-events: none;
}

.pen-subtitle {
  padding-left: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.save-status {
  color: var(--success);
  font-weight: 500;
}

/* Botones de Barra Superior */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: #000000;
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: #141414;
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-accent {
  background: #000000;
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent:hover {
  background: #141414;
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-ghost {
  background: #000000;
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  background: #141414;
  border-color: rgba(255, 255, 255, 0.25);
}

.badge-pill {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.divider {
  width: 1px;
  height: 22px;
  background: var(--border-subtle);
  margin: 0 4px;
}

/* Switch Auto-Run */
.autorun-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.autorun-toggle input {
  display: none;
}

.toggle-track {
  width: 28px;
  height: 16px;
  background: #334155;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
}

.autorun-toggle input:checked+.toggle-track {
  background: var(--success);
}

.autorun-toggle input:checked+.toggle-track::after {
  transform: translateX(12px);
}

.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Layout Switcher */
.layout-switcher {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
}

.layout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.layout-btn:hover {
  color: var(--text-main);
}

.layout-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ==================== ÁREA DE TRABAJO & LAYOUTS ==================== */
.workspace {
  height: calc(100vh - var(--topbar-height));
  width: 100%;
  display: flex;
  overflow: hidden;
}

/* Layout 1: Top (Editores arriba, Preview abajo) */
body[data-layout="top"] .workspace {
  flex-direction: column;
}

body[data-layout="top"] .editors-pane {
  height: 50%;
  width: 100%;
}

body[data-layout="top"] .preview-pane {
  flex: 1;
  width: 100%;
}

body[data-layout="top"] .editors-split {
  flex-direction: row;
}

body[data-layout="top"] .main-gutter {
  height: 6px;
  width: 100%;
  cursor: row-resize;
}

body[data-layout="top"] .editor-gutter {
  width: 6px;
  height: 100%;
  cursor: col-resize;
}

/* Layout 2: Left (Editores a la izquierda, Preview a la derecha) */
body[data-layout="left"] .workspace {
  flex-direction: row;
}

body[data-layout="left"] .editors-pane {
  width: 45%;
  height: 100%;
}

body[data-layout="left"] .preview-pane {
  flex: 1;
  height: 100%;
}

body[data-layout="left"] .editors-split {
  flex-direction: column;
}

body[data-layout="left"] .main-gutter {
  width: 6px;
  height: 100%;
  cursor: col-resize;
}

body[data-layout="left"] .editor-gutter {
  height: 6px;
  width: 100%;
  cursor: row-resize;
}

/* Layout 3: Right (Preview a la izquierda, Editores a la derecha) */
body[data-layout="right"] .workspace {
  flex-direction: row-reverse;
}

body[data-layout="right"] .editors-pane {
  width: 45%;
  height: 100%;
}

body[data-layout="right"] .preview-pane {
  flex: 1;
  height: 100%;
}

body[data-layout="right"] .editors-split {
  flex-direction: column;
}

body[data-layout="right"] .main-gutter {
  width: 6px;
  height: 100%;
  cursor: col-resize;
}

body[data-layout="right"] .editor-gutter {
  height: 6px;
  width: 100%;
  cursor: row-resize;
}

/* Layout 4: Tabs (Pestañas a la izquierda, Preview a la derecha) */
body[data-layout="tabs"] .workspace {
  flex-direction: row;
}

body[data-layout="tabs"] .editors-pane {
  width: 48%;
  height: 100%;
}

body[data-layout="tabs"] .preview-pane {
  flex: 1;
  height: 100%;
}

body[data-layout="tabs"] .editor-tabs-bar {
  display: flex;
}

body[data-layout="tabs"] .editor-gutter {
  display: none !important;
}

body[data-layout="tabs"] .editor-panel {
  display: none;
}

body[data-layout="tabs"] .editor-panel.active-tab {
  display: flex;
  flex: 1 1 100% !important;
}

body[data-layout="tabs"] .main-gutter {
  width: 6px;
  height: 100%;
  cursor: col-resize;
}

/* ==================== CONTENEDOR DE EDITORES ==================== */
.editors-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  min-width: 200px;
  min-height: 140px;
  overflow: hidden;
}

.editor-tabs-bar {
  display: none;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 6px 10px 0;
  gap: 6px;
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.tab-pill.active {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.4);
}

.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.html-dot {
  background: var(--html-color);
}

.css-dot {
  background: var(--css-color);
}

.js-dot {
  background: var(--js-color);
}

.editors-split {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 33.333%;
  min-width: 110px;
  min-height: 80px;
  overflow: hidden;
  background: var(--bg-surface);
}

.editor-panel.maximized {
  flex: 1 1 100% !important;
}

.editor-panel.hidden-by-max {
  display: none !important;
}

.editor-header {
  height: 34px;
  padding: 0 10px;
  background: #000000;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #cbd5e1;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.html-badge {
  background: rgba(249, 115, 22, 0.18);
  color: var(--html-color);
}

.css-badge {
  background: rgba(56, 189, 248, 0.18);
  color: var(--css-color);
}

.js-badge {
  background: rgba(250, 204, 21, 0.18);
  color: var(--js-color);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.font-size-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1px 3px;
}

.font-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.font-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.font-size-val {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  min-width: 28px;
  text-align: center;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.editor-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Ajustes de CodeMirror — Fondo 100% Negro */
.CodeMirror,
.CodeMirror-scroll,
.CodeMirror-Sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumbers,
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
  background: #000000 !important;
  background-color: #000000 !important;
}

.CodeMirror {
  position: absolute !important;
  inset: 0;
  height: 100% !important;
  width: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: var(--editor-font-size, 14px) !important;
  line-height: 1.55 !important;
  color: #f8fafc !important;
}

.CodeMirror-activeline-background {
  background: rgba(255, 255, 255, 0.05) !important;
}

.CodeMirror-gutters {
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ==================== DIVISORES REDIMENSIONABLES (GUTTERS) ==================== */
.gutter {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 10;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.gutter::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
}

body[data-layout="top"] .main-gutter::after,
body[data-layout="left"] .editor-gutter::after,
body[data-layout="right"] .editor-gutter::after {
  width: 36px;
  height: 2px;
}

body[data-layout="top"] .editor-gutter::after,
body[data-layout="left"] .main-gutter::after,
body[data-layout="right"] .main-gutter::after,
body[data-layout="tabs"] .main-gutter::after {
  width: 2px;
  height: 36px;
}

.gutter:hover,
.gutter.dragging {
  background: var(--accent);
}

body.is-resizing {
  user-select: none !important;
}

body.is-resizing .iframe-drag-shield {
  display: block !important;
}

/* ==================== PANEL DE VISTA PREVIA ==================== */
.preview-pane {
  display: flex;
  flex-direction: column;
  background: #000000;
  min-width: 220px;
  min-height: 140px;
  overflow: hidden;
  position: relative;
}

.preview-toolbar {
  height: 38px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 10px;
  user-select: none;
}

.preview-toolbar-left,
.preview-toolbar-center,
.preview-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red {
  background: #ef4444;
}

.dot.yellow {
  background: #f59e0b;
}

.dot.green {
  background: #10b981;
}

.address-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.url-text {
  font-family: var(--font-mono);
}

.viewport-dims {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.viewport-switcher {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  opacity: 0.75;
}

.vp-btn svg {
  color: #ffffff;
  flex-shrink: 0;
}

.vp-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.vp-btn.active {
  opacity: 1;
  background: #1f1f1f;
  color: #ffffff;
}

.console-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.console-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.console-badge {
  background: #334155;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 99px;
}

.console-badge.has-errors {
  background: var(--danger);
  color: #fff;
}

.preview-stage {
  flex: 1;
  width: 100%;
  background: #000000;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: auto;
  position: relative;
}

.iframe-container {
  width: 100%;
  height: 100%;
  background: transparent;
  position: relative;
  transition: width 0.22s ease;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.8);
}

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
}

.iframe-drag-shield {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  background: transparent;
}

/* ==================== CONSOLA INTEGRADA ==================== */
.console-drawer {
  height: 195px;
  background: #000000;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

.console-drawer.collapsed {
  height: 0;
  border-top: none;
  overflow: hidden;
}

.console-header {
  height: 34px;
  padding: 0 12px;
  background: #000000;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.console-filters {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.filter-chip {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--accent-soft);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.35);
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-xs {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.btn-xs:hover {
  background: rgba(255, 255, 255, 0.12);
}

.console-logs {
  flex: 1;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 0;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.45;
  word-break: break-word;
}

.log-entry.log-info,
.log-entry.log-log {
  color: #e2e8f0;
}

.log-entry.log-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
  border-left: 3px solid var(--warning);
}

.log-entry.log-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-left: 3px solid var(--danger);
}

.log-entry.log-result {
  color: #a5b4fc;
}

.log-time {
  color: var(--text-dim);
  font-size: 10.5px;
  flex-shrink: 0;
}

.log-content {
  flex: 1;
  white-space: pre-wrap;
}

.console-repl {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #000000;
  border-top: 1px solid var(--border-subtle);
}

.repl-prompt {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}

#consoleReplInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
}

#consoleReplInput:focus {
  outline: none;
}

/* ==================== MODALES ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

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

.modal-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalPop 0.18s ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 20px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-desc {
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Grid de Plantillas */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.template-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.template-card:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

.template-card h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.template-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Mis Pens Guardados */
.saved-pens-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.saved-pens-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-pen-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

.saved-pen-meta strong {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.saved-pen-meta span {
  font-size: 11px;
  color: var(--text-dim);
}

.saved-pen-btns {
  display: flex;
  gap: 6px;
}

/* Librerías CDN */
.libs-section {
  margin-bottom: 16px;
}

.libs-section h3 {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quick-libs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-lib-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-lib-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.libs-textarea {
  width: 100%;
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Opciones de Exportación */
.export-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.export-card-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-card-btn:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.export-icon {
  font-size: 26px;
}

.export-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.export-info span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #000000;
  color: #f8fafc;
  border: 1px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  transition: all 0.2s ease;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

@media (max-width: 900px) {
  .topbar-center .btn span {
    display: none;
  }

  .pen-title-input {
    width: 140px;
  }
}