:root {
  color-scheme: dark;
  --bg: #07060f;
  --ink: #f4f1ff;
  --muted: #a39bbd;
  --line: rgba(255, 255, 255, 0.12);
  --glow: #7c6bff;
  --accent: #9ae7ff;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 50% 18%, rgba(124, 107, 255, 0.22), transparent 60%),
    var(--bg);
  color: var(--ink);
}

body {
  min-height: 100dvh;
}

button, input {
  font: inherit;
  color: inherit;
}

.gate, main {
  min-height: 100dvh;
  padding: 24px 18px calc(18px + env(safe-area-inset-bottom));
}

.gate:not([hidden]) {
  display: grid;
  place-items: center;
}

[hidden] {
  display: none !important;
}

.gate form, main {
  width: min(560px, 100%);
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
}

.muted, .error { color: var(--muted); }

.error { color: #ffb4c4; min-height: 1.2em; }

.gate input, .composer input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 14px 16px;
}

.gate button, .composer button, .projects button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: #fff;
  color: #120f1e;
  cursor: pointer;
}

.gate button { width: 100%; margin-top: 8px; }

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.pill {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

.stage {
  height: 280px;
  display: grid;
  place-items: center;
}

canvas {
  width: min(280px, 72vw);
  height: min(280px, 72vw);
}

.projects {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 8px;
}

.projects button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.projects button.active {
  background: #fff;
  color: #120f1e;
}

.log {
  min-height: 28dvh;
  max-height: 34dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 16px;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.bubble.user {
  align-self: flex-start;
  background: rgba(154, 231, 255, 0.12);
}

.bubble.bot {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.06);
}

.bubble.live { outline: 1px solid rgba(154, 231, 255, 0.35); }

.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(transparent, var(--bg) 24%);
}

.composer button[aria-pressed="true"] {
  background: #ff5d7a;
  color: white;
}

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .stage { height: 220px; }
}
