:root {
  --bg-1: #090f1f;
  --bg-2: #101b36;
  --bg-3: #16284e;
  --accent: #77d2ff;
  --accent-2: #89f0d2;
  --text: #f4f8ff;
  --muted: #c0cbdf;
  --card: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.22);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  background-color: var(--bg-1);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background-image:
    radial-gradient(circle at 10% 10%, rgba(87, 134, 255, 0.25), transparent 35%),
    radial-gradient(circle at 90% 15%, rgba(43, 182, 194, 0.17), transparent 35%),
    linear-gradient(165deg, var(--bg-1), var(--bg-2) 48%, var(--bg-3));
  background-attachment: fixed;
  overflow-x: hidden;
}

body {
  position: relative;
  overscroll-behavior-y: none;
}

#particleCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
  width: min(1140px, 92vw);
  margin: 0 auto;
}

.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 3.5rem 0;
}

.hero__inner {
  width: min(980px, 100%);
  text-align: center;
  display: grid;
  gap: 1.25rem;
  justify-items: center;
}

.kicker {
  margin: 0;
  font-family: Bungee, Inter, sans-serif;
  font-size: clamp(1.55rem, 4vw, 3.1rem);
  line-height: 1.3;
  letter-spacing: 0.045em;
  max-width: 34ch;
  text-wrap: pretty;
}

.word {
  display: inline-block;
  margin-right: 0.33ch;
  opacity: 0;
  transform: translateY(10px);
  filter: blur(3px);
}

.kicker.is-visible .word,
.kicker.is-instant .word {
  animation: wordIn 420ms ease forwards;
}

.kicker.is-visible .word:nth-child(1) { animation-delay: 0ms; }
.kicker.is-visible .word:nth-child(2) { animation-delay: 45ms; }
.kicker.is-visible .word:nth-child(3) { animation-delay: 90ms; }
.kicker.is-visible .word:nth-child(4) { animation-delay: 135ms; }
.kicker.is-visible .word:nth-child(5) { animation-delay: 180ms; }
.kicker.is-visible .word:nth-child(6) { animation-delay: 225ms; }
.kicker.is-visible .word:nth-child(7) { animation-delay: 270ms; }
.kicker.is-visible .word:nth-child(8) { animation-delay: 315ms; }
.kicker.is-visible .word:nth-child(9) { animation-delay: 360ms; }
.kicker.is-visible .word:nth-child(10) { animation-delay: 405ms; }
.kicker.is-visible .word:nth-child(11) { animation-delay: 450ms; }
.kicker.is-visible .word:nth-child(12) { animation-delay: 495ms; }
.kicker.is-visible .word:nth-child(13) { animation-delay: 540ms; }

.kicker.is-instant .word { animation-delay: 0ms !important; }

@keyframes wordIn {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.hero__arrow-wrap {
  width: 38px;
  height: 66px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  filter: drop-shadow(0 8px 14px rgba(15, 160, 255, 0.35));
}
.hero__arrow-line { width: 3px; height: 36px; border-radius: 99px; background: linear-gradient(var(--accent), var(--accent-2)); }
.hero__arrow-head { width: 14px; height: 14px; border-right: 3px solid var(--accent); border-bottom: 3px solid var(--accent); transform: rotate(45deg) translateY(-2px); }
.hero__arrow-wrap.is-visible, .hero__arrow-wrap.is-instant { animation: arrowBob 1.3s ease-in-out infinite; }
@keyframes arrowBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

.hero__image-wrap {
  margin: 0;
  width: min(700px, 92vw);
  aspect-ratio: 16 / 7.6;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.2);
}

.hero__image { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

.tools {
  min-height: 100svh;
  padding: 4rem 0 5rem;
  display: grid;
  align-content: center;
  gap: 1.1rem;
}

.tools__header h2 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.5rem); }
.tools__header p { color: var(--muted); }

.tab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.tab-card {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  padding: 1rem;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 160ms ease, border-color 220ms ease, background 220ms ease;
}
.tab-card:hover { transform: translateY(-2px); }
.tab-card.is-active { border-color: var(--accent); background: rgba(127, 211, 255, 0.2); }

.tool-panel { border: 1px solid var(--card-border); border-radius: 14px; padding: 1rem 1.1rem; background: rgba(7, 11, 28, 0.52); backdrop-filter: blur(8px); }

.assistant-shell { display: grid; gap: 0.9rem; min-height: 66svh; }
.assistant-header h3 { margin: 0; }
.assistant-header p { margin: 0.2rem 0 0; color: var(--muted); }
.api-key-row { display: grid; gap: 0.5rem; }
.api-key-row label { font-size: 0.92rem; color: var(--muted); }
.api-key-controls { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }
.api-key-controls input,
.chat-composer textarea {
  border: 1px solid var(--card-border);
  background: rgba(4, 8, 21, 0.76);
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
}
.api-key-controls button,
#sendBtn {
  border: 1px solid transparent;
  background: linear-gradient(145deg, #6bc5ff, #7ce5cb);
  color: #02121f;
  border-radius: 10px;
  font-weight: 700;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}

.chat-messages {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.8rem;
  min-height: 300px;
  max-height: 50svh;
  overflow: auto;
  background: rgba(6, 10, 27, 0.6);
  display: grid;
  gap: 0.6rem;
}

.msg {
  padding: 0.6rem 0.75rem;
  border-radius: 11px;
  width: fit-content;
  max-width: min(100%, 70ch);
  white-space: pre-wrap;
}
.msg.user { background: rgba(123, 211, 255, 0.2); margin-left: auto; }
.msg.assistant { background: rgba(255, 255, 255, 0.08); }
.msg img { max-width: min(320px, 100%); border-radius: 10px; margin-top: 0.5rem; display: block; }

.attachment-preview {
  font-size: 0.92rem;
  color: var(--muted);
  border: 1px dashed var(--card-border);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}

.chat-composer { display: grid; grid-template-columns: auto 1fr auto; gap: 0.55rem; align-items: end; margin-top: auto; }
.attach-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 1.2rem;
}
.attach-btn input { display: none; }
.chat-composer textarea { resize: none; min-height: 40px; max-height: 140px; }

.reveal { opacity: 0; transform: translateY(20px); }
.reveal.is-visible, .reveal.is-instant { opacity: 1; transform: translateY(0); transition: opacity 450ms ease, transform 450ms ease; }
.reveal.is-instant { transition-duration: 110ms; }

@media (max-width: 760px) {
  .hero { padding: 2rem 0; }
  .kicker { max-width: 22ch; font-size: clamp(1.3rem, 8.5vw, 2rem); }
  .tab-grid { grid-template-columns: 1fr; }
  .tools { padding-top: 2rem; }
  .hero__image-wrap { aspect-ratio: 16 / 10; }
  .chat-composer { grid-template-columns: 1fr; }
  .attach-btn, #sendBtn { width: 100%; border-radius: 10px; height: 42px; }
}


.inline-launch { color: var(--accent); font-weight: 700; text-decoration: none; }
.inline-launch:hover { text-decoration: underline; }

.analyser-body {
  background-image:
    radial-gradient(circle at 0% 0%, rgba(76, 145, 255, 0.24), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(68, 222, 235, 0.18), transparent 35%),
    radial-gradient(circle at 50% 120%, rgba(63, 116, 255, 0.2), transparent 45%),
    linear-gradient(155deg, #060c1b, #0d1b3d 46%, #0a2b4d);
}

.analyser-main {
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  margin: 0 auto;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 1.2rem 0;
}

.analyser-shell {
  border: 1px solid rgba(136, 184, 255, 0.25);
  background: linear-gradient(160deg, rgba(8, 18, 45, 0.84), rgba(8, 25, 58, 0.7));
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.analyser-topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.analyser-topbar h1 { margin: 0; font-size: clamp(1.1rem, 2.2vw, 1.55rem); }
.back-link { color: #b7d6ff; text-decoration: none; border: 1px solid rgba(255,255,255,0.2); border-radius: 10px; padding: 0.4rem 0.65rem; }
.back-link:hover { border-color: var(--accent); }

.chat-messages.tech { min-height: 56svh; max-height: 62svh; border-radius: 16px; background: linear-gradient(180deg, rgba(6, 12, 32, 0.78), rgba(8, 20, 44, 0.56)); }
.chat-dock {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 0.55rem;
  border: 1px solid rgba(160, 192, 255, 0.28);
  background: rgba(4, 11, 30, 0.85);
  border-radius: 16px;
  padding: 0.45rem;
}

.chat-dock textarea {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.6rem 0.25rem;
  resize: none;
  min-height: 38px;
  max-height: 170px;
}

.attach-btn.plus { width: 40px; height: 40px; border-radius: 12px; font-size: 1.35rem; }
.chat-dock #sendBtn { padding: 0.62rem 0.9rem; border-radius: 12px; }

@media (max-width: 760px) {
  .analyser-shell { padding: 0.8rem; border-radius: 14px; }
  .chat-messages.tech { min-height: 50svh; }
  .chat-dock { grid-template-columns: 1fr; }
  .attach-btn.plus, .chat-dock #sendBtn { width: 100%; height: 42px; }
}
