/* ===========================================================================
   da-lle — ChatGPT-style interface
   Font: classy (global)   ·   Palette: fixed token set only
   =========================================================================== */

@font-face {
  font-family: 'classy';
  src: url('https://vkfonts.storage.googleapis.com/classy.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple:       #8B78FF;
  --purple-light: #B3B5E3;
  --silver:       #bec2cb;
  --matte1:       #171717;
  --matte2:       #181c1f;
  --matte3:       #272727;
  --black:        #000000;
  --text:         #cacaca;
  --radius:       18px;
  --max:          760px;
}

/* classy everywhere, incl. buttons/inputs; kill the tap highlight */
* {
  box-sizing: border-box;
  font-family: 'classy', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font-family: inherit; }

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

body {
  background: var(--black);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

/* Universe canvas --------------------------------------------------------- */
#c {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

/* soft black vignette so text stays legible over the network */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 42%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.72) 100%);
}

/* Top bar ----------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(0,0,0,0.85), rgba(0,0,0,0));
}

.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark {
  color: var(--purple);
  font-size: 18px;
  filter: drop-shadow(0 0 8px rgba(139,120,255,0.55));
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 18px;
  color: var(--text);
}

.db-link {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  color: var(--silver);
  border: 1px solid var(--matte3);
  background: rgba(24,28,31,0.6);
  transition: color .18s, border-color .18s, transform .18s;
}
.db-link:hover {
  color: var(--purple);
  border-color: var(--purple);
  transform: translateY(-1px);
}

/* Stage / layout ---------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 56px 16px 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--matte3) transparent;
}
.stage::-webkit-scrollbar { width: 8px; }
.stage::-webkit-scrollbar-thumb { background: var(--matte3); border-radius: 8px; }

/* Welcome ----------------------------------------------------------------- */
.welcome {
  max-width: var(--max);
  margin: 0 auto;
  min-height: calc(100vh - 230px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}
.welcome.hidden { display: none; }

.welcome-mark {
  font-size: 44px;
  color: var(--purple);
  filter: drop-shadow(0 0 20px rgba(139,120,255,0.6));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.welcome-title {
  font-weight: 700;
  font-size: clamp(26px, 6vw, 38px);
  letter-spacing: 0.3px;
  margin: 2px 0 0;
  color: var(--text);
}
.accent { color: var(--purple); }

.welcome-sub {
  color: var(--silver);
  margin: 0;
  max-width: 440px;
  font-size: 14.5px;
}

/* Rotating suggestions — even 2x2 grid ------------------------------------ */
.suggestions {
  margin-top: 14px;
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.chip {
  width: 100%;
  border: 1px solid var(--matte3);
  background: rgba(24,28,31,0.72);
  color: var(--text);
  padding: 13px 14px;
  border-radius: 14px;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: opacity .45s ease, transform .45s ease, border-color .18s, background .18s, color .18s;
  opacity: 0;
  transform: translateY(6px);
}
.chip.show { opacity: 1; transform: translateY(0); }
.chip:hover {
  border-color: var(--purple);
  background: rgba(139,120,255,0.12);
  color: var(--purple-light);
}

/* Chat -------------------------------------------------------------------- */
.chat {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: rise .28s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.user { flex-direction: row-reverse; }

.avatar {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}
.avatar.bot { background: var(--purple); color: var(--black); }
.avatar.you { background: var(--matte3); color: var(--silver); border: 1px solid var(--matte3); }

.bubble {
  padding: 11px 15px;
  border-radius: 14px;
  max-width: 78%;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}
.msg.bot  .bubble { background: var(--matte2); border: 1px solid var(--matte3); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--matte3); border: 1px solid var(--matte3); border-top-right-radius: 4px; }

/* typing indicator */
.dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--silver);
  animation: blink 1.4s infinite both;
}
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40%           { opacity: 1;  transform: translateY(-3px); }
}

/* Composer ---------------------------------------------------------------- */
.composer-wrap {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 5;
  padding: 12px 16px 14px;
  background: linear-gradient(0deg, var(--black) 55%, rgba(0,0,0,0));
}
.composer {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--matte2);
  border: 1px solid var(--matte3);
  border-radius: var(--radius);
  padding: 8px 8px 8px 16px;
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,120,255,0.16);
}
.input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  resize: none;
  max-height: 160px;
  padding: 6px 0;
  line-height: 1.5;
}
.input::placeholder { color: var(--silver); }

.send {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--purple);
  color: var(--black);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .18s, opacity .18s, transform .1s;
}
.send:hover { background: var(--purple-light); }
.send:active { transform: scale(.94); }
.send:disabled { opacity: .4; cursor: not-allowed; }

.disclaimer {
  max-width: var(--max);
  margin: 8px auto 0;
  text-align: center;
  color: var(--silver);
  font-size: 11.5px;
}

/* Focus visibility -------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .suggestions { grid-template-columns: 1fr; max-width: 340px; }
  .bubble { max-width: 84%; }
  .stage { padding-bottom: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-mark { animation: none; }
}
