@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #050505;
  --bg-alt: #0a0a0a;
  --panel: rgba(12, 12, 12, 0.92);
  --panel-strong: rgba(18, 18, 18, 0.98);
  --surface: rgba(20, 20, 20, 0.88);
  --surface-soft: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(122, 255, 180, 0.24);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --muted-strong: #e4e4e7;
  --accent: #7affb4;
  --accent-soft: rgba(122, 255, 180, 0.12);
  --danger: #ff8b8b;
  --danger-soft: rgba(255, 139, 139, 0.1);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  padding: 16px;
  overflow: hidden;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(122, 255, 180, 0.08), transparent 24%),
    linear-gradient(180deg, #050505 0%, #090909 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03) 0.5px, transparent 0.6px),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.03) 0.5px, transparent 0.6px),
    radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.025) 0.5px, transparent 0.6px);
  background-size: 140px 140px;
  opacity: 0.22;
}

body.cursor-hovering .cursor-dot {
  transform: translate(-50%, -50%) scale(1.7);
  background: rgba(122, 255, 180, 0.95);
  box-shadow: 0 0 0 10px rgba(122, 255, 180, 0.1);
}

body.cursor-hovering .cursor-glow {
  opacity: 0.34;
}

.ambient {
  position: fixed;
  pointer-events: none;
  filter: blur(70px);
  z-index: -1;
}

.ambient-one {
  top: -140px;
  left: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(122, 255, 180, 0.08), transparent 72%);
}

.ambient-two {
  right: -100px;
  bottom: -120px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(122, 255, 180, 0.06), transparent 72%);
}

.cursor-glow,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.cursor-glow {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(122, 255, 180, 0.12) 0%,
    rgba(122, 255, 180, 0.05) 28%,
    transparent 70%
  );
  filter: blur(12px);
}

.cursor-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(122, 255, 180, 0.88);
  box-shadow: 0 0 0 6px rgba(122, 255, 180, 0.06);
}

body.cursor-active .cursor-glow,
body.cursor-active .cursor-dot {
  opacity: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
}

.page-shell {
  width: min(940px, calc(100vw - 32px));
  min-height: calc(100dvh - 32px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
}

.home-link,
.top-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.96), rgba(12, 12, 12, 0.98));
  color: var(--muted-strong);
  font-size: 0.82rem;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.top-link-primary {
  background: linear-gradient(135deg, rgba(57, 216, 154, 0.24), rgba(122, 255, 180, 0.14));
  border-color: rgba(122, 255, 180, 0.24);
  color: #baffc5;
}

.top-link-primary:hover {
  background: linear-gradient(135deg, rgba(57, 216, 154, 0.32), rgba(122, 255, 180, 0.18));
  border-color: var(--accent);
  color: #baffc5;
}

.home-link {
  justify-self: start;
}

.top-link {
  justify-self: end;
}

.home-link::before {
  content: "←";
}

.home-link:hover,
.top-link:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--text);
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.98), rgba(14, 14, 14, 0.98));
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(122, 255, 180, 0.05);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(122, 255, 180, 0.08);
}

.brand-name,
.eyebrow,
.app-kicker,
.message-meta,
.select-group span {
  font-family: "JetBrains Mono", monospace;
}

.brand-name {
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.app-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(13, 13, 13, 0.96), rgba(8, 8, 8, 0.98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  max-width: 720px;
  margin: 0 auto 0.5rem;
  text-align: center;
}

.eyebrow,
.app-kicker {
  color: var(--accent);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  margin-top: 0.2rem;
  font-size: clamp(1.15rem, 2.7vw, 1.72rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.lede {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.prompt-grid {
  display: none;
}

.prompt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.58rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 22, 22, 0.98), rgba(12, 12, 12, 0.98));
  color: var(--muted-strong);
  font-size: 0.82rem;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.prompt-chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(26, 26, 26, 0.98), rgba(15, 15, 15, 0.98));
  color: var(--text);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.22),
    0 0 0 1px rgba(122, 255, 180, 0.04);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-pill,
.model-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  font-size: 0.8rem;
}

.conversation {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.15rem 0.2rem 1rem 0;
}

.conversation::-webkit-scrollbar {
  width: 10px;
}

.conversation::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  background-clip: padding-box;
}

.conversation-inner {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 100%;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: flex-start;
}

.message.user {
  align-items: flex-end;
}

.message-meta {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message-body,
.source-card,
.composer {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(18, 18, 18, 0.96), rgba(12, 12, 12, 0.98));
}

.message.assistant .message-body,
.message.system .message-body {
  max-width: min(680px, 100%);
}

.message.user .message-body {
  max-width: min(620px, 100%);
  background:
    linear-gradient(180deg, rgba(24, 24, 24, 0.98), rgba(16, 16, 16, 0.98));
  border-color: rgba(122, 255, 180, 0.14);
}

.message.system .message-body {
  border-color: rgba(255, 139, 139, 0.16);
  background:
    linear-gradient(180deg, rgba(28, 18, 18, 0.96), rgba(18, 12, 12, 0.98));
}

.message-body {
  width: fit-content;
  padding: 0.82rem 0.9rem;
  font-size: 0.86rem;
  line-height: 1.6;
}

.message-body p,
.message-body li {
  color: var(--muted-strong);
  max-width: 58ch;
}

.message-body.has-sources {
  width: min(100%, 680px);
}

.message-body.has-sources p,
.message-body.has-sources li {
  max-width: none;
}

.message-body p + p {
  margin-top: 0.8rem;
}

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

.message-body code {
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92em;
}

.response-list {
  padding-left: 1.2rem;
}

.response-list li + li {
  margin-top: 0.45rem;
}

.sources-label {
  margin-top: 0.8rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.source-card {
  display: block;
  padding: 0.9rem;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.source-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(22, 22, 22, 0.98), rgba(14, 14, 14, 0.98));
}

.source-title {
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
}

.source-url {
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.76rem;
  word-break: break-word;
}

.source-snippet {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.loading-dots span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 900ms infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.composer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto;
  padding: 0.45rem 0.55rem;
  background:
    linear-gradient(180deg, rgba(12, 12, 12, 0.92), rgba(10, 10, 10, 0.98));
  box-shadow:
    0 -18px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.composer-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.composer input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 46px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
  text-overflow: ellipsis;
  outline: none;
}

.composer input::placeholder {
  color: var(--muted);
}

.composer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.toggle,
.select-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.toggle input {
  accent-color: var(--accent);
}

.select-group select {
  min-width: 72px;
  padding: 0.48rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(22, 22, 22, 0.98), rgba(13, 13, 13, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  outline: none;
}

.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(122, 255, 180, 0.26);
  border-radius: 15px;
  background: linear-gradient(135deg, #39d89a 0%, #7affb4 100%);
  color: #07110c;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow:
    0 14px 30px rgba(122, 255, 180, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.02);
  box-shadow:
    0 18px 36px rgba(122, 255, 180, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.submit-btn:disabled,
.composer input:disabled,
.select-group select:disabled,
.toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes blink {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.28;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  body {
    padding: 10px;
    overflow-y: auto;
  }

  .cursor-glow,
  .cursor-dot {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .home-link {
    justify-self: center;
    width: 100%;
    justify-content: center;
  }

  .app-panel {
    min-height: calc(100dvh - 110px);
    padding: 0.75rem;
    border-radius: 24px;
  }

  .hero h1 {
    font-size: 1.3rem;
  }

  .prompt-grid {
    justify-content: flex-start;
  }

  .app-meta,
  .composer-options {
    justify-content: flex-start;
  }

  .conversation {
    padding-bottom: 0.85rem;
  }

  .message.assistant .message-body,
  .message.system .message-body,
  .message.user .message-body,
  .message-body.has-sources {
    max-width: 100%;
  }

  .message-body {
    width: 100%;
  }

  .message-body p,
  .message-body li {
    max-width: none;
  }

  .sources {
    grid-template-columns: 1fr;
  }

  .composer-row {
    gap: 0.45rem;
  }

  .composer input {
    height: 44px;
    font-size: 0.88rem;
  }

  .submit-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
}
