/* PREVI — Ilustrama Labs design system */
:root {
  --marfil: #f5f4f0;
  --carbon: #06070a;
  --grafito: #0e0f12;
  --muted: #8a8a86;
  --border: rgba(17, 17, 16, 0.08);
  --shadow: 0 4px 24px rgba(17, 17, 16, 0.06);
  --shadow-lg: 0 12px 48px rgba(17, 17, 16, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 56px;
  --rail-w: 72px;
  --console-w: min(320px, 32vw);
  --accent: #E1306C;
  --accent-soft: rgba(225, 48, 108, 0.12);
  --accent-mid: rgba(225, 48, 108, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.45s;
  --bg: var(--marfil);
  --surface: #ffffff;
  --text: var(--carbon);
  --text-muted: var(--muted);
  --hero-bg: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] {
  --bg: var(--carbon);
  --surface: #0e0f12;
  --text: var(--marfil);
  --text-muted: #7a7a76;
  --border: #1e1f21;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.28);
  --hero-bg: rgba(26, 26, 24, 0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── Nav ─── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; flex-direction: column; gap: 1px; }
.logo-mark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #ff2d7a 0%, #8b5cf6 50%, #3b82f6 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradShift 4s ease infinite;
}
@keyframes gradShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.logo-lab {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-end { display: flex; align-items: center; gap: 14px; }
.nav-site {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  transition: color 0.2s;
}
.nav-site:hover { color: var(--text); }
.btn-install {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 100px;
  transition: background 0.2s, border-color 0.2s;
}
.btn-install:hover {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
}
.btn-install[hidden] { display: none; }
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
}
.theme-track {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 100px;
  position: relative;
  transition: background var(--dur);
}
.theme-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform var(--dur) var(--ease), background var(--dur);
}
[data-theme="dark"] .theme-thumb { transform: translateX(20px); }
.theme-icon { color: var(--text-muted); display: flex; }

/* ─── Hero ─── */
.hero {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: calc(var(--nav-h) + 48px) clamp(24px, 5vw, 48px) 40px;
  padding-left: max(clamp(24px, 5vw, 48px), env(safe-area-inset-left));
  padding-right: max(clamp(24px, 5vw, 48px), env(safe-area-inset-right));
  text-align: center;
  background: var(--hero-bg);
  transition: background var(--dur);
  box-sizing: border-box;
}
.hero-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.7s var(--ease) 0.1s forwards;
}
.hero-title {
  font-size: clamp(32px, 5.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.8s var(--ease) 0.2s forwards;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, #ff2d7a 0%, #8b5cf6 50%, #3b82f6 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradShift 4s ease infinite;
}
.hero-sub {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.8s var(--ease) 0.35s forwards;
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ─── Workspace ─── */
.workspace {
  display: grid;
  grid-template-areas: "rail console preview";
  grid-template-columns: var(--rail-w) minmax(260px, var(--console-w)) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: calc(100vh - var(--nav-h) - 160px);
  min-height: calc(100dvh - var(--nav-h) - 160px);
  border-top: 1px solid var(--border);
}
.network-rail { grid-area: rail; }
.console { grid-area: console; }
.preview-stage { grid-area: preview; }

/* ─── Network rail ─── */
.network-rail {
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  height: calc(100vh - var(--nav-h) - 48px);
  height: calc(100dvh - var(--nav-h) - 48px);
  max-height: calc(100dvh - var(--nav-h));
  transition: background var(--dur);
  z-index: 10;
}
.rail-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.net-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.3s var(--ease);
  position: relative;
}
.net-btn svg { width: 22px; height: 22px; }
.net-btn:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}
.net-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  box-shadow: var(--shadow);
}
.net-btn.active::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  animation: railPulse 0.4s var(--ease);
}
@keyframes railPulse {
  from { height: 0; opacity: 0; }
  to { height: 20px; opacity: 1; }
}
@media (hover: hover) {
  .net-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: var(--carbon);
    color: var(--marfil);
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
  }
  [data-theme="dark"] .net-btn[data-tip]::after {
    background: var(--marfil);
    color: var(--carbon);
  }
  .net-btn:hover[data-tip]::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* ─── Console ─── */
.console {
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: var(--nav-h);
  align-self: start;
  height: calc(100vh - var(--nav-h) - 48px);
  height: calc(100dvh - var(--nav-h) - 48px);
  max-height: calc(100dvh - var(--nav-h));
  min-width: 0;
  transition: background var(--dur);
  z-index: 10;
}
.console-scroll {
  padding: 20px 18px 32px;
  overflow-y: auto;
  height: 100%;
}
.panel-block { margin-bottom: 22px; }
.panel-block--actions { margin-top: 8px; }
.panel-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.panel-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.fmt-btn {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  color: var(--text-muted);
  transition: all 0.25s var(--ease);
  line-height: 1.3;
}
.fmt-btn span { display: block; font-size: 9px; opacity: 0.7; margin-top: 2px; }
.fmt-btn:hover { border-color: var(--accent-mid); color: var(--text); }
.fmt-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--accent);
  font-weight: 600;
}
.profile-row { display: flex; gap: 10px; align-items: flex-start; }
.avatar-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.25s;
}
.avatar-btn:hover { border-color: var(--accent-mid); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { font-size: 18px; color: var(--text-muted); font-weight: 300; }
.profile-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field--sm { font-size: 11px; }
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-field span {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
}
.upload-icon { color: var(--text-muted); }
.upload-text { font-size: 12px; font-weight: 500; }
.upload-hint { font-size: 10px; color: var(--text-muted); }
.media-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.media-thumb {
  width: 52px; height: 52px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s;
}
.media-thumb.active { border-color: var(--accent); }
.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.slider-row input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}
.caption {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 12px;
  line-height: 1.55;
  outline: none;
}
.caption:focus { border-color: var(--accent-mid); box-shadow: 0 0 0 3px var(--accent-soft); }
.caption-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.25s var(--ease);
  margin-bottom: 8px;
}
.btn--primary {
  background: var(--text);
  color: var(--bg);
}
.btn--primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn--accent {
  background: var(--accent);
  color: #fff;
}
.btn--accent:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--ghost {
  width: auto;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn--sm { margin-bottom: 0; }
.export-size {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ─── Preview stage ─── */
.preview-stage {
  padding: 24px clamp(16px, 3vw, 40px) 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  position: relative;
  min-height: 480px;
  min-width: 0;
}
.preview-toolbar {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  font-size: 11px;
}
.preview-network {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent);
  transition: color var(--dur);
}
.preview-format { color: var(--text-muted); }
.preview-canvas-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}
.preview-glow {
  position: absolute;
  width: min(420px, 90%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  filter: blur(40px);
  opacity: 0.6;
  pointer-events: none;
  transition: background var(--dur);
}
.preview-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(420px, 100%);
  animation: previewIn 0.55s var(--ease);
}
.preview-frame .mock,
.preview-frame .vv-frame,
.preview-frame .profile-card,
.preview-frame .banner-card {
  width: 100%;
  max-width: 100%;
}
.preview-frame.swap { animation: previewSwap 0.5s var(--ease); }
@keyframes previewIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes previewSwap {
  0% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.4; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}
.preview-placeholder {
  padding: 80px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
}

/* Editor viewport overlay */
.editor-viewport {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: color-mix(in srgb, var(--carbon) 55%, transparent);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
}
.editor-viewport[hidden] { display: none !important; }
.editor-crop {
  position: relative;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  touch-action: none;
  cursor: grab;
}
.editor-crop:active { cursor: grabbing; }
.editor-crop img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  max-width: none;
  user-select: none;
  pointer-events: none;
  will-change: transform;
}
.editor-overlay-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--marfil);
  opacity: 0.8;
}
.editor-viewport .btn {
  margin-top: 20px;
  max-width: 200px;
}

/* ─── Mockup frames (shared) ─── */
.mock {
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
}
[data-theme="dark"] .mock--dark-native {
  background: #000;
  color: #fff;
  border-color: rgba(255,255,255,0.08);
}
.mock-media {
  position: relative;
  overflow: hidden;
  background: #1a1a18;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mock-media img, .mock-media video,
.mock-media-fill {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mock-media .mock-media-fill {
  object-fit: fill;
}
.mock-media--empty {
  aspect-ratio: var(--ar, 1);
  min-height: 120px;
}
.mock-ph {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}
.mock-ph svg { opacity: 0.25; margin: 0 auto 8px; }
.mock-ph p { font-size: 11px; }

/* Instagram */
.ig-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.ig-user { display: flex; align-items: center; gap: 9px; }
.ig-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  padding: 2px;
  flex-shrink: 0;
}
.ig-av-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--surface);
  overflow: hidden;
}
.ig-av-inner img { width: 100%; height: 100%; object-fit: cover; }
.ig-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.ig-loc { font-size: 11px; color: var(--text-muted); }
.ig-actions {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px 6px;
}
.ig-actions-l { display: flex; gap: 14px; }
.ig-act { color: var(--text); opacity: 0.9; }
.ig-likes { padding: 0 12px 4px; font-size: 13px; font-weight: 600; }
.ig-cap { padding: 0 12px 8px; font-size: 13px; line-height: 1.45; }
.ig-cap strong { font-weight: 600; margin-right: 4px; }
.ig-more { padding: 0 12px 10px; font-size: 12px; color: var(--text-muted); }
.ig-time { padding: 0 12px 12px; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ig-dots { display: flex; justify-content: center; gap: 4px; padding: 8px 0 4px; }
.ig-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.ig-dot.on { background: var(--accent); }

/* X */
.x-h { display: flex; gap: 10px; padding: 12px 14px 0; }
.x-av { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--border); flex-shrink: 0; }
.x-av img { width: 100%; height: 100%; object-fit: cover; }
.x-meta { flex: 1; min-width: 0; }
.x-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.x-verified { color: var(--accent); font-size: 14px; }
.x-handle { font-size: 13px; color: var(--text-muted); }
.x-body { padding: 4px 14px 10px 64px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.x-stats { display: flex; gap: 20px; padding: 12px 14px 14px 64px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.x-stat strong { color: var(--text); }

/* Facebook */
.fb-h { display: flex; gap: 10px; padding: 12px 14px; align-items: center; }
.fb-av { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--border); }
.fb-av img { width: 100%; height: 100%; object-fit: cover; }
.fb-name { font-weight: 600; font-size: 15px; }
.fb-time { font-size: 12px; color: var(--text-muted); }
.fb-body { padding: 0 14px 10px; font-size: 15px; line-height: 1.35; }
.fb-react { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border); }
.fb-bar { display: flex; border-top: 1px solid var(--border); }
.fb-bar button { flex: 1; padding: 10px; font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* YouTube */
.yt-thumb { position: relative; background: #0f0f0f; }
.yt-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.yt-play-icon {
  width: 68px; height: 48px;
  background: rgba(255,0,0,0.9);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.yt-dur {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.85);
  color: #fff; font-size: 11px; font-weight: 500;
  padding: 2px 6px; border-radius: 4px;
}
.yt-info { padding: 12px 14px; display: flex; gap: 12px; }
.yt-ch-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: var(--border); }
.yt-ch-av img { width: 100%; height: 100%; object-fit: cover; }
.yt-title { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-meta { font-size: 12px; color: var(--text-muted); }

/* LinkedIn */
.li-h { display: flex; gap: 10px; padding: 12px 14px; }
.li-av { width: 48px; height: 48px; border-radius: 4px; overflow: hidden; background: var(--border); }
.li-av img { width: 100%; height: 100%; object-fit: cover; }
.li-name { font-weight: 600; font-size: 14px; }
.li-head { font-size: 12px; color: var(--text-muted); }
.li-time { font-size: 11px; color: var(--text-muted); }
.li-body { padding: 0 14px 10px; font-size: 14px; line-height: 1.45; }
.li-stats { padding: 8px 14px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.li-bar { display: flex; }
.li-bar span { flex: 1; text-align: center; padding: 12px 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* Pinterest */
.pt-pin { position: relative; }
.pt-save {
  position: absolute; top: 12px; right: 12px;
  background: #e60023;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 24px;
}
.pt-info { padding: 12px 14px; }
.pt-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }

/* Vertical video (TikTok, Shorts, Reels…) */
.vv-frame {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
}
.vv-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
}
.vv-stage .mock-media {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  aspect-ratio: unset !important;
}
.vv-gradient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.45) 0%,
    transparent 22%,
    transparent 52%,
    rgba(0, 0, 0, 0.55) 72%,
    rgba(0, 0, 0, 0.88) 100%
  );
}
.vv-side {
  position: absolute;
  right: 10px;
  bottom: 88px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  z-index: 4;
  color: #fff;
}
.vv-side-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.vv-side-item svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.vv-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  padding: 16px 56px 18px 14px;
  z-index: 4;
  box-sizing: border-box;
}
.vv-user { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vv-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.vv-av img { width: 100%; height: 100%; object-fit: cover; }
.vv-name { color: #fff; font-weight: 700; font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.vv-cap {
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  word-break: break-word;
}

/* Threads */
.th-h { display: flex; gap: 10px; padding: 14px; }
.th-av { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; }
.th-av img { width: 100%; height: 100%; object-fit: cover; }
.th-body { flex: 1; font-size: 15px; line-height: 1.4; }
.th-name { font-weight: 700; margin-right: 6px; }
.th-actions { display: flex; gap: 16px; padding: 8px 14px 14px 60px; color: var(--text-muted); }

/* Bluesky */
.bsky-h { display: flex; gap: 10px; padding: 12px 14px 0; }
.bsky-av { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; }
.bsky-av img { width: 100%; height: 100%; object-fit: cover; }
.bsky-body { padding: 4px 14px 12px 66px; font-size: 15px; line-height: 1.4; }

/* Profile / Banner layouts */
.mock--profile .mock-media { border-radius: 0; }
.mock--banner .mock-media { border-radius: 0; }
.profile-card {
  text-align: center;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.profile-card .mock-media {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 12px;
  overflow: hidden;
}
.profile-card--square .mock-media { border-radius: 8px; }
.banner-card .mock-media { width: 100%; border-radius: 8px 8px 0 0; }

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(20px, 4vw, 40px);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.footer-brand a {
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer-brand a:hover { color: var(--text); }
.footer-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}
.footer-share:hover { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--carbon);
  color: var(--marfil);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s;
  z-index: 500;
  pointer-events: none;
}
[data-theme="dark"] .toast {
  background: var(--marfil);
  color: var(--carbon);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet, móvil, pantallas grandes
   ═══════════════════════════════════════════════════════════════ */

/* Tablet landscape / ventana estrecha */
@media (max-width: 1100px) {
  :root {
    --console-w: 300px;
  }

  .workspace {
    grid-template-areas:
      "rail preview"
      "console console";
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    grid-template-rows: minmax(360px, 1fr) auto;
  }

  .network-rail {
    height: auto;
    min-height: 100%;
    align-self: stretch;
  }

  .console {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .console-scroll {
    max-height: none;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .preview-stage {
    min-height: 360px;
    padding: 20px 16px 28px;
  }

  .format-grid {
    grid-template-columns: repeat(3, 1fr);
    max-height: 200px;
  }
}

/* Tablet portrait / móvil grande */
@media (max-width: 768px) {
  :root {
    --nav-h: 52px;
    --rail-w: 100%;
  }

  .nav {
    padding: 0 max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
    gap: 8px;
  }

  .nav-end {
    gap: 8px;
  }

  .nav-site {
    font-size: 11px;
  }

  .btn-install {
    padding: 5px 10px;
    font-size: 10px;
  }

  .hero {
    padding: calc(var(--nav-h) + 28px) 20px 28px;
  }

  .hero-title {
    font-size: clamp(28px, 8vw, 40px);
  }

  .hero-sub {
    font-size: 14px;
    margin-bottom: 0;
  }

  .workspace {
    grid-template-areas:
      "rail"
      "preview"
      "console";
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    min-height: 0;
  }

  /* Rail horizontal deslizable */
/* Rail horizontal deslizable */
  .network-rail {
    position: sticky;
    top: var(--nav-h);
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 30;
    
    /* --- Solución al desbordamiento --- */
    width: 100vw;
    max-width: 100%;
    min-width: 0;
  }

  .rail-inner {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .rail-inner::-webkit-scrollbar {
    display: none;
  }

  .net-btn {
    flex-shrink: 0;
    scroll-snap-align: center;
    width: 44px;
    height: 44px;
  }

  .net-btn.active::before {
    left: 50%;
    top: auto;
    bottom: 2px;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 2px 2px 0 0;
  }

  .preview-stage {
    order: 0;
    min-height: min(70vw, 420px);
    padding: 16px 12px 24px;
  }

  .preview-toolbar {
    max-width: 100%;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 14px;
  }

  .preview-format {
    font-size: 10px;
    width: 100%;
  }

  .preview-glow {
    width: min(100%, 320px);
  }

  .console {
    border-top: 1px solid var(--border);
  }

  .format-grid {
    grid-template-columns: repeat(3, 1fr);
    max-height: none;
  }

  .panel-block--actions {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-top: 12px;
    margin-bottom: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .editor-viewport {
    padding: calc(var(--nav-h) + 12px) 12px max(20px, env(safe-area-inset-bottom));
  }

  .editor-viewport .btn {
    max-width: 100%;
    width: min(280px, 100%);
  }

  .vv-frame {
    max-width: min(100%, 300px);
  }

  .footer {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px max(14px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
  }

  .toast {
    bottom: max(20px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

/* Móvil pequeño */
@media (max-width: 480px) {
  .logo-lab {
    display: none;
  }

  .logo-mark {
    font-size: 20px;
  }

  .nav-site {
    font-size: 10px;
  }

  .btn-install:not([hidden]) {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hero-eyebrow {
    font-size: 9px;
    margin-bottom: 10px;
  }

  .format-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .upload-zone {
    padding: 20px 12px;
  }

  .preview-placeholder {
    padding: 48px 16px;
  }

  .btn {
    padding: 14px 16px;
    font-size: 13px;
  }

  .field,
  .caption,
  .field--sm {
    font-size: 16px;
  }

  .vv-bottom {
    padding-right: 52px;
  }
}

/* Pantallas muy anchas */
@media (min-width: 1400px) {
  :root {
    --console-w: 340px;
  }

  .preview-frame {
    max-width: 460px;
  }

  .preview-glow {
    width: min(460px, 90%);
  }
}

/* Preferencia movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
