* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --bg: #0b0f19;
  --panel: #111927;
  --panel-2: #161c2a;
  --border: rgba(255,255,255,.08);
  --accent: #00d9d9;
  --accent-ink: #06222a;
  --text: #f5f7fb;
  --text-soft: #a6b0c3;
  --green: #10b981;
  --amber: #ffca28;
}
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
}
.back-link { color: var(--text-soft); text-decoration: none; font-size: .85rem; }
.back-link:hover { color: var(--accent); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

main { max-width: 1180px; margin: 0 auto; padding: 40px 24px 80px; }

.intro { max-width: 720px; margin: 0 auto 32px; text-align: center; }
.intro-eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.intro h1 { font-size: 1.9rem; margin: 0 0 14px; line-height: 1.25; }
.intro p { color: var(--text-soft); line-height: 1.6; font-size: .96rem; }
.intro-actions { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 24px; flex-wrap: wrap; }

.btn-play {
  background: linear-gradient(135deg, var(--accent), #00b8b8);
  color: var(--accent-ink); border: none; border-radius: 10px;
  padding: 13px 26px; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.btn-play:hover { transform: translateY(-1px); }
.btn-play:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.subtitle-toggle {
  display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-soft); cursor: pointer;
}
.subtitle-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- Contenedor del reel: SIEMPRE vertical (9:16), a diferencia del recorrido guiado
   que cambia de layout según escritorio/mobile. Este demo simula directamente cómo se ve una
   grabación de pantalla de celular en formato reel. ---------- */
.reel-wrap { max-width: 420px; margin: 0 auto; position: relative; }
.reel-wrap:fullscreen { max-width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #000; }
.reel-wrap:fullscreen .reel-canvas { height: min(100vh, 780px); }

.btn-reel-fullscreen {
  position: absolute; top: 10px; right: 10px; z-index: 20;
  background: rgba(10,14,22,.75); border: 1px solid var(--border); color: var(--text-soft);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: .95rem;
}
.btn-reel-fullscreen:hover { color: var(--accent); border-color: var(--accent); }

.reel-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 34px;
  border: 10px solid #1c2536;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px var(--border);
  overflow: hidden;
}

.reel-scene { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- Escena 1-3: teléfono del cliente ---------- */
.reel-scene-phone { background: #05070c; }
.reel-phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 34%; height: 22px; background: #05070c; border-radius: 0 0 14px 14px; z-index: 5;
}
.reel-site-mock { position: absolute; inset: 0; padding: 30px 16px 16px; }
.reel-site-mock-topbar { height: 10px; width: 40%; background: rgba(255,255,255,.12); border-radius: 4px; margin-bottom: 22px; }
.reel-site-mock-hero { display: flex; flex-direction: column; gap: 10px; }
.reel-site-mock-line { height: 12px; background: rgba(255,255,255,.08); border-radius: 4px; }
.reel-site-mock-line.w70 { width: 70%; }
.reel-site-mock-line.w40 { width: 40%; }

.client-bubble {
  position: absolute; right: 16px; bottom: 20px;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00b8b8);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); box-shadow: 0 8px 24px rgba(0,217,217,.35);
  transition: transform .2s ease, opacity .2s ease; z-index: 3;
}
.client-bubble svg { width: 22px; height: 22px; }
.client-bubble.hidden-bubble { opacity: 0; transform: scale(.5); pointer-events: none; }

.client-window {
  position: absolute; inset: 0;
  background: #0f1522;
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn .25s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.client-window-head {
  display: flex; align-items: center; gap: 8px;
  padding: 32px 14px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border);
  font-size: .85rem; font-weight: 600;
}
.client-window-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.client-window-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.client-window-input { border-top: 1px solid var(--border); padding: 10px; }
.client-window-input input {
  width: 100%; background: #0b0f19; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; color: var(--text); font-size: .85rem;
}

.msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: .82rem; line-height: 1.4; animation: msgIn .2s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-in  { align-self: flex-start; background: #1b2333; color: var(--text); border-bottom-left-radius: 3px; }
.msg-out { align-self: flex-end; background: linear-gradient(135deg, var(--accent), #00b8b8); color: var(--accent-ink); font-weight: 500; border-bottom-right-radius: 3px; }

/* ---------- Escena 4-9: mockup de laptop, letterboxed dentro del canvas vertical ---------- */
.reel-scene-laptop { background: #05070c; align-items: center; justify-content: center; padding: 0 14px; }
.reel-laptop-mock { width: 100%; animation: msgIn .25s ease; }
.reel-laptop-screen {
  background: var(--panel); border: 2px solid #263047; border-radius: 8px 8px 2px 2px;
  aspect-ratio: 16 / 10; overflow: hidden; display: flex; flex-direction: column;
}
.reel-laptop-base { height: 8px; background: linear-gradient(180deg, #263047, #1c2536); border-radius: 0 0 6px 6px; margin: 0 -6px; }

.reel-laptop-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* panel del agente, versión compacta del mismo lenguaje visual del recorrido guiado */
#panelAgent { flex-direction: row; }
.agent-sidebar-mini { width: 34%; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.agent-sidebar-mini-head { padding: 6px 8px; font-size: .58rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); border-bottom: 1px solid var(--border); }
.agent-chat-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; }
.agent-chat-item {
  display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 6px; margin-bottom: 2px; position: relative;
}
.agent-chat-item.selected { background: rgba(0,217,217,.1); }
.agent-chat-item.entering { animation: itemPulse 1s ease; }
@keyframes itemPulse { 0% { background: rgba(0,217,217,.35); } 100% { background: transparent; } }
.chat-avatar-circle {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .56rem; font-weight: 700; color: #fff;
}
.agent-chat-item-info { min-width: 0; flex: 1; }
.agent-chat-item-name { font-size: .56rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-chat-item-preview { font-size: .5rem; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.agent-thread-mini { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.agent-thread-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-soft); font-size: .6rem; }
.agent-thread-open { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: msgIn .2s ease; }
.agent-thread-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.agent-thread-name { font-size: .6rem; font-weight: 700; }
.agent-thread-messages { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.agent-thread-messages .msg { font-size: .58rem; padding: 6px 8px; }
.agent-thread-input { border-top: 1px solid var(--border); padding: 5px; }
.agent-thread-input input {
  width: 100%; background: #0b0f19; border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 7px; color: var(--text); font-size: .58rem;
}

/* pantallas de configuración (dominio / widget), mismo lenguaje visual del panel real
   rediseñado en la Tarea 5 de la Etapa 2 -- chip circular + tarjeta, replicado acá como mockup
   estático de marketing, no una copia literal del CSS privado del panel. */
.reel-config-domain, .reel-config-widget { padding: 12px; justify-content: flex-start; gap: 10px; }
.config-card-head { display: flex; align-items: center; gap: 8px; }
.config-chip {
  width: 24px; height: 24px; border-radius: 50%; background: rgba(0,217,217,.12);
  display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0;
}
.config-title { font-size: .64rem; font-weight: 700; }
.config-sub { font-size: .52rem; color: var(--text-soft); }
.config-mode-row { display: flex; gap: 4px; flex-wrap: wrap; }
.config-mode-pill {
  font-size: .5rem; padding: 3px 7px; border-radius: 20px; border: 1px solid var(--border); color: var(--text-soft);
}
.config-mode-pill.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.config-input-row { display: flex; gap: 6px; }
.config-input {
  flex: 1; background: #0b0f19; border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 7px; color: var(--text); font-size: .56rem;
}
.config-btn-save {
  background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 5px 9px;
  font-size: .54rem; font-weight: 700; white-space: nowrap;
}
.config-code-block {
  background: #05070c; border: 1px solid var(--border); border-radius: 6px; padding: 8px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: .5rem; color: var(--accent);
  word-break: break-all; line-height: 1.5;
}
.config-copy-row { display: flex; align-items: center; gap: 8px; }
.config-btn-copy {
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 5px; padding: 5px 10px; font-size: .54rem; font-weight: 700; cursor: default;
}
.config-copied-toast { font-size: .54rem; color: var(--green); font-weight: 700; animation: msgIn .2s ease; }

/* ---------- Escena final ---------- */
.reel-scene-outro {
  background: radial-gradient(circle at 50% 40%, #101c2c, #05070c 70%);
  align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 20px;
  animation: msgIn .3s ease;
}
/* ETAPA 5 (doc39, 2026-08-01), Tarea 4.1: logo arriba del nombre, tamaño acotado. */
.outro-logo { width: 64px; height: auto; margin-bottom: 4px; }
.outro-brand { font-size: 1.3rem; font-weight: 800; }
.outro-brand span { color: var(--accent); }
.outro-tag { font-size: .7rem; color: var(--text-soft); }
.outro-cta { margin-top: 10px; font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; }

/* ---------- Subtítulos ---------- */
/* ETAPA 5 (doc39, 2026-08-01), Tarea 4.1: texto más grande (antes .68rem). Posición por
   defecto (escena teléfono): centro-abajo de la pantalla, como ya estaba. */
.reel-subtitle-bar {
  position: absolute; left: 10px; right: 10px; bottom: 14px; z-index: 10;
  text-align: center; font-size: .82rem; line-height: 1.45; color: var(--text);
  background: rgba(10, 14, 22, .88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 9px 12px;
  animation: subtitleIn .2s ease;
}
/* Escena laptop: arriba del mockup, a 30px del margen superior, para no taparlo -- pedido
   explícito ("arriba de lo que se muestra en el panel, no tapándolo"). */
.reel-subtitle-bar.reel-subtitle-top {
  top: 30px;
  bottom: auto;
}
@keyframes subtitleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.replay-wrap { text-align: center; margin-top: 20px; }
.btn-replay { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

.footnote { max-width: 640px; margin: 36px auto 0; text-align: center; }
.footnote p { color: var(--text-soft); font-size: .78rem; line-height: 1.6; }
.footnote a { color: var(--accent); }

.client-window-body, .agent-chat-list, .agent-thread-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
