/* chudGTP: dark, mopey, slightly damp. */
:root {
  --bg: #0d0f14;
  --bg-2: #141821;
  --panel: #191e29;
  --panel-2: #212736;
  --line: #2a3142;
  --text: #d6dae3;
  --muted: #8a92a6;
  --dim: #5d6579;
  --accent: #8c7bd9;      /* bruised purple */
  --accent-2: #6fa3c7;    /* rainy-window blue */
  --danger: #d97b7b;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(140, 123, 217, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111, 163, 199, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }

/* Gentle rain in the background. Pure CSS, purely emotional. */
.rain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.18;
  background-image: repeating-linear-gradient(
    105deg, transparent 0 22px, rgba(160, 180, 210, 0.35) 22px 23px, transparent 23px 60px
  );
  background-size: 200px 200px;
  animation: rain 1.1s linear infinite;
}
@keyframes rain { to { background-position: -40px 200px; } }
@media (prefers-reduced-motion: reduce) { .rain { animation: none; } }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px;
  background: rgba(13, 15, 20, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em;
}
.logo img { width: 30px; height: 30px; }
.logo .gtp { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: var(--accent); color: #0d0f14; font-weight: 650; text-decoration: none;
  border: 0; cursor: pointer; font: inherit; font-weight: 650;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { background: #a194e6; transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--text); background: var(--panel); }

/* ---------- landing page ---------- */
main.page { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 56px 24px 32px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0 0 8px; }
.hero .sigh { font-family: var(--mono); color: var(--dim); font-size: 0.9rem; }

.faq { margin-top: 40px; display: grid; gap: 12px; }
.faq details {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 20px; transition: border-color 0.2s ease;
}
.faq details[open] { border-color: #3b4560; }
.faq summary {
  cursor: pointer; list-style: none; padding: 14px 0; font-weight: 650;
  display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--dim); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq .a { color: var(--muted); padding: 0 0 16px; }
.faq .a p { margin: 0 0 10px; }

.cta-card {
  margin-top: 40px; padding: 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(140,123,217,0.14), rgba(111,163,199,0.08));
  border: 1px solid var(--line); text-align: center;
}
.cta-card p { color: var(--muted); margin: 0 0 16px; }

.parody {
  position: relative; z-index: 1;
  text-align: center; color: var(--dim); font-size: 0.8rem; padding: 24px 16px 32px;
}

/* ---------- chat page ---------- */
body.chat { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.chat-main { position: relative; z-index: 1; flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread { max-width: 760px; margin: 0 auto; padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 14px; }

.empty { text-align: center; padding: 8vh 12px 12px; }
.empty img { width: 72px; height: 72px; opacity: 0.9; }
.empty h1 { margin: 12px 0 4px; font-size: 1.8rem; letter-spacing: -0.02em; }
.empty h1 .gtp { color: var(--accent); }
.empty p { color: var(--muted); margin: 0 0 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  font: inherit; font-size: 0.92rem; color: var(--text); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: var(--panel-2); border-color: #3b4560; }

.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.avatar { width: 30px; height: 30px; flex: none; }
.bubble {
  max-width: min(78%, 560px); padding: 10px 14px; border-radius: 18px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  animation: pop 0.18s ease-out;
}
.msg.bot .bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.user .bubble { background: var(--accent); color: #0d0f14; border-bottom-right-radius: 6px; }
.msg.error .bubble { background: rgba(217,123,123,0.12); border: 1px solid rgba(217,123,123,0.4); color: #f0c4c4; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } }

.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer-wrap { position: relative; z-index: 2; border-top: 1px solid var(--line); background: rgba(13,15,20,0.9); }
.composer { max-width: 760px; margin: 0 auto; padding: 12px 20px 6px; }
.composer form {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 16px;
}
.composer form:focus-within { border-color: #4a5577; }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; line-height: 1.5; max-height: 200px; padding: 6px 0;
}
.composer textarea::placeholder { color: var(--dim); }
.send {
  width: 38px; height: 38px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--accent); color: #0d0f14; display: grid; place-items: center; flex: none;
}
.send:disabled { background: var(--panel-2); color: var(--dim); cursor: not-allowed; }
.hint { text-align: center; color: var(--dim); font-size: 0.75rem; padding: 4px 0 10px; }

@media (max-width: 560px) {
  .topbar { padding: 12px 14px; }
  .topbar .btn { padding: 8px 12px; font-size: 0.9rem; }
  .bubble { max-width: 85%; }
}
