:root {
  --bg: #000000;
  --bg-elevated: #141516;
  --bg-bubble-user: #1d2b16;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f1f1ef;
  --text-secondary: #98989d;
  --text-tertiary: #6b6b72;
  --verde: #59e721;
  --azul: #46b1e1;
  --focus-ring: rgba(89, 231, 33, 0.45);
  --font-display: "Albert Sans", Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(89, 231, 33, 0.28); }
a { color: var(--verde); text-decoration: none; }
button { font-family: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 20px 64px;
  overflow-x: clip;
}

/* Aurora ambiental */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.16; will-change: transform; }
.aurora span:nth-child(1) {
  width: 620px; height: 620px; top: -260px; left: 50%;
  background: var(--verde);
  animation: drift1 26s ease-in-out infinite;
}
.aurora span:nth-child(2) {
  width: 520px; height: 520px; bottom: -280px; right: -120px;
  background: var(--azul); opacity: 0.12;
  animation: drift2 32s ease-in-out infinite;
}
@keyframes drift1 { 0%, 100% { transform: translate(-50%, 0) scale(1); } 50% { transform: translate(-46%, 40px) scale(1.08); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-30px, -30px) scale(1.1); } }

.explore-link {
  position: fixed; top: 20px; right: 24px; z-index: 3;
  font-size: 13px; letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.explore-link:hover, .explore-link:focus-visible { color: var(--text-primary); border-color: var(--border-strong); outline: none; }

.wordmark {
  position: relative; z-index: 1; margin-bottom: 40px;
  opacity: 0; transform: translateY(6px);
  animation: reveal 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s forwards;
  transition: margin 0.4s ease;
}
.wordmark img { display: block; width: 260px; height: auto; transition: width 0.4s ease; }

.headline {
  position: relative; z-index: 1; margin: 0;
  text-align: center; max-width: 720px;
  font-size: clamp(28px, 4.4vw, 42px); font-weight: 500;
  line-height: 1.28; letter-spacing: -0.01em; text-wrap: balance;
}
.headline .line { display: block; opacity: 0; transform: translateY(8px); animation: reveal 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s forwards; }
.headline .line.dim { color: var(--text-secondary); animation-delay: 0.34s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

.composer {
  position: relative; z-index: 2; width: min(680px, 100%); margin-top: 44px;
  opacity: 0; transform: translateY(10px);
  animation: reveal 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.5s forwards;
}
.input-shell {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 27px; padding: 8px 8px 8px 22px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-shell:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 4px var(--focus-ring); }
#composerInput {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: var(--font-display); font-size: 16px; padding: 10px 0;
}
#composerInput::placeholder { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 14px; }
.send-btn {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--verde); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.35; cursor: default; transform: none; }
.send-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.hint { margin-top: 14px; text-align: center; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-tertiary); }
.hint kbd { font-family: inherit; border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px; font-size: 10px; }

/* Conversación */
.exchange { position: relative; z-index: 1; width: min(680px, 100%); display: none; flex-direction: column; gap: 14px; }
.bubble {
  max-width: 86%; padding: 13px 17px; border-radius: 16px;
  font-size: 15px; line-height: 1.55;
  opacity: 0; transform: translateY(6px);
  animation: reveal 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.bubble p { margin: 0; }
.bubble p + p { margin-top: 10px; }
.bubble.user { align-self: flex-end; background: var(--bg-bubble-user); border: 1px solid rgba(89, 231, 33, 0.22); white-space: pre-wrap; }
.bubble.assistant { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); }
.bubble .question { color: var(--text-primary); font-weight: 600; }
.bubble .muted { color: var(--text-secondary); }
.bubble ul { margin: 10px 0 0; padding-left: 18px; }
.bubble li + li { margin-top: 6px; }

.handoff-card {
  align-self: flex-start; max-width: 86%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px 14px 18px; border-radius: 16px;
  border: 1px solid rgba(89, 231, 33, 0.35);
  background: linear-gradient(135deg, rgba(89, 231, 33, 0.1), rgba(70, 177, 225, 0.06));
  opacity: 0; transform: translateY(6px);
  animation: reveal 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s forwards;
}
.handoff-card strong { display: block; font-size: 15px; font-weight: 600; }
.handoff-card span { display: block; margin-top: 3px; font-size: 13px; color: var(--text-secondary); }
.handoff-card a {
  flex-shrink: 0; padding: 10px 16px; border-radius: 999px;
  background: var(--verde); color: #0a0a0b; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.handoff-card a:hover { background: #7ef04a; }
.handoff-card a:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

.typing {
  align-self: flex-start; display: flex; align-items: center; gap: 5px;
  padding: 14px 16px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 16px;
}
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--verde); animation: pulse 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }

/* Modo conversación */
.bubble, .handoff-card, .typing { scroll-margin-bottom: 120px; }
body.is-chatting .stage { justify-content: flex-start; padding-top: 28px; padding-bottom: 0; }
body.is-chatting .wordmark { margin-bottom: 28px; }
body.is-chatting .wordmark img { width: 150px; }
body.is-chatting .headline, body.is-chatting .hint { display: none; }
body.is-chatting .exchange { display: flex; flex: 1; padding-bottom: 24px; }
body.is-chatting .composer {
  position: sticky; bottom: 0; margin-top: 0; padding: 16px 0 24px;
  background: linear-gradient(to top, #000 70%, rgba(0, 0, 0, 0));
}
body.is-chatting .footer-tag { display: none; }

.footer-tag {
  position: fixed; left: 20px; bottom: 18px; z-index: 1;
  font-size: 10.5px; letter-spacing: 0.08em; color: var(--text-tertiary);
}

@media (max-width: 560px) {
  .stage { padding-top: 76px; }
  .wordmark img { width: 200px; }
  .headline { font-size: 26px; }
  .composer { margin-top: 36px; }
  .footer-tag { display: none; }
  .explore-link { top: 16px; right: 16px; }
  body.is-chatting .stage { padding-top: 64px; }
  .bubble, .handoff-card { max-width: 100%; }
  .handoff-card { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora span { animation: none; }
  .wordmark, .headline .line, .composer, .bubble, .handoff-card { animation: none; opacity: 1; transform: none; }
}
