:root {
  --bg:        #0b0d10;
  --panel:    #11151b;
  --line:    #1d232c;
  --ink:    #d7dee7;
  --muted: #6b7480;
  --accent: #b58cff;        /* manim purple */
  --green: #3ddc84;
  --red:     #ff6b6b;
  --amber: #f6c177;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand .prompt { color: var(--green); }
.brand .title { font-weight: 700; letter-spacing: 0.3px; }
.brand .sub { color: var(--muted); font-size: 12px; }

.meters { display: flex; gap: 16px; align-items: center; }
.meter { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.meter #active { color: var(--ink); font-weight: 500; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); display: inline-block;
}
.dot.live { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.hero {
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 24px 0 48px;
  position: relative;
}
.hero-title {
  font-size: clamp(22px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 10px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-title::before { content: "$ "; color: var(--green); }
.hero-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 26px;
}
.hero-input { box-shadow: 0 8px 40px rgba(181,140,255,0.08); }
.hero-input textarea { min-height: 180px; font-size: 15px; }
.scroll-hint {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  align-self: center;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%,100% { transform: translateY(0); opacity: 0.5; }
  50%     { transform: translateY(4px); opacity: 1; }
}

.examples {
  padding: 32px 0 8px;
  scroll-margin-top: 20px;
}
.examples-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--accent);
}
.examples-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 22px;
}
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.example {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none !important;
  transition: transform 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
}
.example:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.example img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
  display: block;
}
.example-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}
.example-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.example.playing { transform: none; }
.example.playing:hover { transform: none; }
.example-meta { padding: 12px 14px; }
.example-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 4px;
}
.example-prompt {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  font-style: italic;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.bar {
  padding: 8px 14px;
  background: #0f1318;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.status {
  color: var(--amber);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status.done { color: var(--green); }
.status.failed { color: var(--red); }
.status.idle { color: var(--muted); }

textarea {
  width: 100%;
  min-height: 130px;
  background: transparent;
  border: none;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
textarea::placeholder { color: var(--muted); }

.controls {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 14px;
  border-top: 1px solid var(--line);
}
button {
  background: var(--accent);
  color: #0b0d10;
  border: none;
  padding: 7px 14px;
  font-family: inherit;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 11px; }
.err { color: var(--red); font-size: 12px; margin-left: auto; }

pre#log {
  margin: 0;
  padding: 14px;
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  color: var(--ink);
}
pre#log .ok   { color: var(--green); }
pre#log .err  { color: var(--red); }
pre#log .info { color: var(--muted); }

.result {
  border-top: 1px solid var(--line);
  padding: 14px;
}
.result.hidden { display: none; }
.result video {
  width: 100%;
  border-radius: 4px;
  background: #000;
}
.result .links { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; gap: 14px; }

.meter.gh { text-decoration: none !important; color: var(--muted); }
.meter.gh:hover { color: var(--ink); }
.meter.gh svg { vertical-align: -2px; margin-right: 2px; }

#recent { list-style: none; padding: 8px 14px 14px; margin: 0; max-height: 240px; overflow: auto; }
#recent li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
}
#recent li:last-child { border-bottom: none; }
#recent .when { color: var(--muted); font-size: 11px; min-width: 64px; }
#recent .prompt-text {
  flex: 1; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#recent a { font-size: 12px; }
#recent .empty { color: var(--muted); }

footer {
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 32px;
}

@media (max-width: 600px) {
  header { padding: 14px 16px; }
  main { padding: 0 12px; }
  .hero-title { white-space: normal; font-size: 20px; }
}
