:root {
  --bg: #0d0d0f;
  --bg-elevated: #111114;
  --bg-soft: #16161a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --gold: #f59e0b;
  --coral: #f97066;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 14px;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(6, 182, 212, 0.18), transparent 55%),
    radial-gradient(900px 500px at 85% 20%, rgba(139, 92, 246, 0.12), transparent 50%),
    radial-gradient(700px 400px at 10% 60%, rgba(245, 158, 11, 0.06), transparent 45%),
    var(--bg);
  line-height: 1.55;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(13, 13, 15, 0.72);
  border-bottom: 1px solid var(--line);
}

.site-header .inner,
.container {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.nav a {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

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

.nav .auth-link {
  color: var(--text);
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.nav .auth-link.primary {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  border-color: transparent;
  color: #041016;
  font-weight: 700;
}

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 3.5rem 0 4rem;
  overflow: hidden;
}

.hero-spotlight {
  position: absolute;
  inset: 12% auto auto 50%;
  width: min(520px, 80vw);
  height: min(520px, 80vw);
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(6, 182, 212, 0.28), transparent 68%);
  filter: blur(8px);
  animation: pulse-glow 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.7;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
}

.hero-inner {
  position: relative;
  text-align: center;
  max-width: 720px;
}

.hero-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.hero-brand img {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.35), 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: float-logo 5.5s ease-in-out infinite;
}

@keyframes float-logo {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.hero-brand .name {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(120deg, #fff 20%, var(--cyan) 55%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e4e4e7;
}

.hero-lead {
  margin: 0 auto 1.6rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.eq {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 28px;
  margin-top: 2.25rem;
  opacity: 0.7;
}

.eq span {
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(to top, var(--cyan), var(--violet));
  animation: eq 1.1s ease-in-out infinite;
}

.eq span:nth-child(1) {
  height: 40%;
}
.eq span:nth-child(2) {
  height: 70%;
  animation-delay: 0.12s;
}
.eq span:nth-child(3) {
  height: 100%;
  animation-delay: 0.24s;
}
.eq span:nth-child(4) {
  height: 55%;
  animation-delay: 0.08s;
}
.eq span:nth-child(5) {
  height: 80%;
  animation-delay: 0.2s;
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.55);
  }
  50% {
    transform: scaleY(1);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #041016;
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.25);
}

.btn-secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: rgba(6, 182, 212, 0.45);
}

.btn-ghost {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--line);
}

section.block {
  padding: 4rem 0;
  border-top: 1px solid var(--line);
}

.block h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.block .sub {
  margin: 0 0 2rem;
  color: var(--muted);
  max-width: 36rem;
}

.feature-list {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .feature-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-list article h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.feature-list article p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.faq details {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}

.faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq details p {
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .inner {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.auth-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;
}

.panel {
  width: min(440px, 100%);
  background: rgba(17, 17, 20, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.panel.wide {
  width: min(640px, 100%);
}

.panel h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.panel .lede {
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.field input,
.field select,
.composer textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field input:focus,
.field select:focus,
.composer textarea:focus {
  outline: 2px solid rgba(6, 182, 212, 0.45);
  border-color: transparent;
}

.form-error {
  color: #fb7185;
  font-size: 0.9rem;
  margin: 0 0 0.85rem;
  min-height: 1.2em;
}

.form-ok {
  color: #34d399;
  font-size: 0.9rem;
  margin: 0 0 0.85rem;
}

.panel .btn {
  width: 100%;
}

.panel .switch {
  margin-top: 1.1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.keys-list {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0;
}

.key-row {
  display: grid;
  gap: 0.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.key-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.key-row .meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.key-row .status {
  color: var(--gold);
}

.key-row .status.on {
  color: #34d399;
}

.profile-line {
  margin: 0 0 0.35rem;
  color: var(--muted);
}

.profile-line strong {
  color: var(--text);
  font-weight: 700;
}

.section-label {
  margin: 1.75rem 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 800;
}

/* Chat app shell */
body.chat-page {
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

.chat-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.chat-sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-sidebar-top {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.75rem;
}

.chat-sidebar-top .brand {
  font-size: 1rem;
}

.conv-list {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
}

.conv-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  margin-bottom: 0.25rem;
}

.conv-item:hover,
.conv-item.active {
  background: rgba(6, 182, 212, 0.12);
  color: var(--text);
}

.conv-item .title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-sidebar-foot {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chat-sidebar-foot a {
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
}

.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.chat-toolbar select {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font: inherit;
}

.messages {
  overflow: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg {
  max-width: min(720px, 100%);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.msg.user {
  align-self: flex-end;
  background: rgba(6, 182, 212, 0.16);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.msg .role {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 28rem;
}

.composer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: end;
}

.composer textarea {
  min-height: 52px;
  max-height: 180px;
  resize: vertical;
}

.composer .btn {
  height: 52px;
  padding-inline: 1.25rem;
}

@media (max-width: 800px) {
  .chat-app {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    display: none;
  }
  .nav .hide-sm {
    display: none;
  }
}
