:root {
  --bg: #0e0f13;
  --surface: #171922;
  --surface-2: #1f2230;
  --border: #2b2f42;
  --text: #e8eaf2;
  --muted: #9aa0b4;
  --accent: #7c6cff;
  --accent-2: #c96cff;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 108, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(201, 108, 255, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

main { width: 100%; max-width: 640px; }

/* ---------- Builder ---------- */

.logo {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-dot { color: var(--text); -webkit-text-fill-color: var(--text); }

.tagline {
  color: var(--muted);
  margin: 6px 0 32px;
  line-height: 1.5;
}

.tagline strong { color: var(--text); }

.field { display: block; margin-bottom: 18px; }

.field > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

textarea, select, input[type="text"], #share-link {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

textarea { resize: vertical; }

textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.2);
}

.linkrow {
  display: flex;
  gap: 8px;
  margin-top: 26px;
}

#share-link {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s, opacity 0.15s;
}

.button:hover { filter: brightness(1.1); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }

.button.ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.button.big { padding: 14px 28px; font-size: 17px; }

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 14px;
}

/* ---------- Playback: fake chat window ---------- */

.chat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 14px;
}

.traffic { display: flex; gap: 6px; }

.traffic i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #444a63;
}

.traffic i:nth-child(1) { background: #ff5f57; }
.traffic i:nth-child(2) { background: #febc2e; }
.traffic i:nth-child(3) { background: #28c840; }

.messages {
  min-height: 260px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 15px;
  animation: pop 0.25s ease;
}

.msg.ai {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.typing { display: flex; gap: 5px; padding: 14px 16px; }

.msg.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1s infinite;
}

.msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.msg.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

@keyframes pop {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.inputbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.fake-input {
  flex: 1;
  min-height: 22px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.fake-input:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.fake-input.typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s;
}

.send.pressed { transform: scale(0.85); }

.caption {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  margin-top: 22px;
  min-height: 1.5em;
  transition: opacity 0.3s;
}

/* ---------- Animated cursor ---------- */

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  transition: transform 0.75s cubic-bezier(0.3, 0.8, 0.3, 1);
  transform: translate(105vw, 105vh);
}

.cursor.clicking svg { transform: scale(0.8); }
.cursor svg { transition: transform 0.1s; }

.click-ripple {
  position: fixed;
  z-index: 49;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  animation: ripple 0.5s ease-out forwards;
}

@keyframes ripple {
  from { transform: scale(0.3); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ---------- End card ---------- */

.endcard {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(6px);
  animation: fade 0.4s ease;
}

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

.endcard .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 44px;
  text-align: center;
  max-width: 440px;
  margin: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: pop 0.35s ease;
}

.endcard h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: -0.02em; }

.endcard p { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }

.makeown {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.makeown:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .cursor, .msg, .endcard, .endcard .card { animation: none; transition: none; }
}
