:root {
  --bg: #242424;
  --card: #fff;
  --ink: #1b1b1b;
  --muted: #7a776f;
  --line: #ece7dc;
  --field: #f4ead6;
  --blue: #2f6bff;
  --blue-deep: #1f54d8;
  --green: #2f9e6b;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  --radius: 22px;
  --font: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }

button { font-family: inherit; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

.page {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 64px;
}

.hero { color: #fff; margin-bottom: 18px; }

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  margin-bottom: 14px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, #fff 0 18%, transparent 19%),
    linear-gradient(#2f6bff 58%, #96f0c0 58%);
  box-shadow: inset 0 0 0 3px #fff;
}

.brand strong { display: block; font-size: 1.2rem; }
.brand small { color: #cfcfcf; }

h1 {
  font-size: 1.55rem;
  margin: 0;
  font-weight: 800;
}

h2 { font-size: 1.2rem; margin: 0 0 8px; }

.card, .note {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}

.note {
  background: #f7f1e4;
  box-shadow: none;
  font-size: 0.95rem;
}

.label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 8px;
}

select, textarea, input[type="text"], input[type="number"], input[type="file"] {
  width: 100%;
  font: 700 1rem var(--font);
  color: var(--ink);
  background: var(--field);
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
}

textarea { resize: vertical; min-height: 120px; }

.prompt-wrap { position: relative; }
.prompt-wrap textarea { padding-bottom: 42px; }

.mic {
  position: absolute;
  left: 10px;
  bottom: 8px;
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
}

.mic.live { filter: hue-rotate(300deg); }

.muted { color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.center { text-align: center; }

.styles, .chips, .thumbs, .history, .feats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.styles { margin-top: 12px; }

.style, .chip, .ghost, .primary, .mini {
  border: 0;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 800;
}

.style, .chip {
  background: #f3f0ea;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.92rem;
}

.style.active, .chip.active, .style.on, .chip.on {
  background: #2a2a2a;
  color: #fff;
}

.drop {
  background: var(--field);
  border-radius: 18px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
}

.drop.over { outline: 3px solid var(--blue); }
.drop-art { font-size: 2rem; }

.thumbs { margin-top: 10px; }

.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #1b1b1b;
  color: #fff;
  cursor: pointer;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0;
  font-weight: 650;
  line-height: 1.35;
}

.check input { margin-top: 4px; accent-color: var(--blue); }

.primary {
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  padding: 12px 18px;
}

.primary:hover { background: var(--blue-deep); }
.primary:disabled { opacity: 0.65; cursor: wait; }

.primary.big {
  width: 100%;
  padding: 16px 18px;
  font-size: 1.05rem;
}

.ghost {
  background: #f3f0ea;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  margin-top: 10px;
}

.go { margin: 16px 0 8px; }
.links { color: #ddd; font-size: 0.92rem; line-height: 1.5; }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.result img, .result video, .result audio {
  display: block;
  width: 100%;
  border-radius: 16px;
  background: #111;
}

.result pre, .result .text-out {
  white-space: pre-wrap;
  background: #f7f4ee;
  border-radius: 16px;
  padding: 14px;
  margin: 0;
  font: 650 0.98rem/1.5 var(--font);
}

.chat {
  min-height: 240px;
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.bubble {
  padding: 10px 12px;
  border-radius: 16px;
  max-width: 92%;
  white-space: pre-wrap;
}

.bubble.user { background: #e8f0ff; justify-self: end; }
.bubble.bot { background: #f4ead6; }

.chat-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

.hist {
  width: 92px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.hist img, .hist video {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 14px;
  background: #ddd;
}

.hist span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.util-grid { display: grid; gap: 10px; }
.util-grid label { display: grid; gap: 6px; font-weight: 800; }

.prose p, .prose li { line-height: 1.55; }
.feats { list-style: none; padding: 0; display: grid; gap: 6px; }
.feats li { background: #f7f4ee; border-radius: 12px; padding: 10px 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(10px);
  background: #111;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 9;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}

.wait {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 24px 8px;
  color: var(--muted);
}

.spin {
  width: 42px;
  height: 42px;
  border: 4px solid #eee;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .pair, .chat-row { grid-template-columns: 1fr; }
  h1 { font-size: 1.28rem; }
}
