:root {
  --bg: #0a0a0a;
  --card: #121212;
  --field: #171717;
  --line: rgba(255, 255, 255, 0.08);
  --text: #ededed;
  --muted: #8b8b8b;
  --faint: #5c5c5c;
  --a: #8b6cff;
  --b: #3fb4ff;
  --c: #ff7fd4;
  --ok: #7ee2b0;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  position: relative;
}

.card {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(14px, 3.2vmin, 20px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(10px, 2.4vmin, 14px);
  font-size: 13px;
  color: var(--muted);
}
.card__doc { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 520; }
.card__doc svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.card__brand { font-size: 12px; letter-spacing: 0.02em; color: var(--faint); }

.prompt {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 10px 14px;
}
.prompt:focus-within { border-color: rgba(255, 255, 255, 0.18); }
/* while generating the prompt box picks up a faint tint of the edge colours */
.prompt { transition: border-color 0.3s, box-shadow 0.6s; }
.prompt.is-busy { border-color: rgba(139, 108, 255, 0.28); box-shadow: 0 0 0 4px rgba(139, 108, 255, 0.06), 0 0 40px -12px rgba(63, 180, 255, 0.25); }
.prompt__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.prompt__field {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: clamp(14px, 2.2vmin + 6px, 16px);
  line-height: 1.45;
  min-height: 2.9em;
}
.prompt__field::placeholder { color: var(--faint); }
.prompt__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.prompt__hint { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the button: the face sits on top, the ring is the gradient edge (a masked conic gradient), the halo is the same
   gradient blurred behind it. The angle of both comes from --ang, written by the script on every frame */
.gen {
  --ang: 0deg;
  --edge: 0;
  --glow: 0;
  position: relative;
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}
.gen:focus-visible { outline: 2px solid var(--b); outline-offset: 4px; }
.gen:disabled { cursor: default; }
.gen__ring, .gen__halo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(from var(--ang), var(--a), var(--b), var(--c), var(--a));
}
.gen__ring {
  padding: 1.5px;
  opacity: var(--edge);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.gen__halo {
  inset: -3px;
  filter: blur(12px);
  opacity: var(--glow);
}
.gen__face {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 13px;
  border-radius: inherit;
  background: #1c1c1c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px -8px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}
.gen__face::after {
  /* a soft top light that the press flattens */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 55%);
  pointer-events: none;
}
.gen__stars { position: relative; width: 18px; height: 18px; flex: none; }
.gen__star, .gen__mini, .gen__check { position: absolute; left: 0; top: 0; width: 18px; height: 18px; overflow: visible; }

.gen__star path { fill: #f1eefe; }
.gen__mini { width: 9px; height: 9px; left: 4.5px; top: 4.5px; opacity: 0; }
.gen__mini path { fill: #dcd6ff; }
.gen__check { opacity: 0; }
.gen__check path { fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.gen__label {
  position: relative;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.gen__label.is-shimmer {
  background: linear-gradient(100deg, #9a9a9a 0%, #9a9a9a 35%, #ffffff 50%, #9a9a9a 65%, #9a9a9a 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gen__label.is-done { color: var(--ok); }

/* the draft below, a fixed height so the card never jumps */
.draft {
  height: clamp(80px, 23vh, 100px);
  margin-top: clamp(10px, 2.4vmin, 14px);
  padding: 0 4px;
  font-size: clamp(13px, 1.8vmin + 6px, 15px);
  line-height: 1.5;
  color: #cfcfcf;
  overflow: hidden;
}
.draft p { margin: 0; }
.draft .w { display: inline-block; white-space: pre; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  z-index: 5;
}
.ghost path { fill: #fff; stroke: #0a0a0a; stroke-width: 1.2; stroke-linejoin: round; }

@media (max-width: 420px) {
  .gen__face { height: 36px; padding: 0 13px 0 11px; }
  .prompt__hint { font-size: 11px; }
  .draft { font-size: 12.5px; }
}
