:root {
  --bg: #0d1117;
  --panel: #161b22;
  --line: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #d2a8ff;
  --focus: #58a6ff;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

a { color: var(--focus); }
button, input { font: inherit; color: inherit; }

/* --- banner: same logo and rainbow as the terminal menu ------------------ */
.banner {
  padding: 28px 16px 8px;
  text-align: center;
  overflow-x: auto;
}
.logo, .subtitle {
  margin: 0 auto;
  display: block;
  width: max-content;
  max-width: 100%;
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1.12;
  background: linear-gradient(90deg, #ff5f5f, #ffaf00, #d7ff00, #5fff5f, #00d7ff, #5f87ff, #af5fff, #ff5fd7, #ff5f5f);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sweep 7s linear infinite;
}
.logo { font-size: clamp(9px, 2.6vw, 17px); text-align: left; }
.subtitle { margin-top: 6px; font-size: clamp(11px, 3vw, 16px); letter-spacing: 0.15em; }
.rule {
  height: 4px; margin: 10px auto; max-width: 780px;
  background: linear-gradient(90deg, #af5fff, #ff5fd7);
  border-radius: 2px;
}
@keyframes sweep { to { background-position: -300% 0; } }

/* --- layout ------------------------------------------------------------- */
main { max-width: 860px; margin: 0 auto; padding: 8px 16px 32px; }
.lead { color: var(--muted); margin: 12px 0 18px; }
h2 { font-size: 1rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600;
     text-transform: uppercase; letter-spacing: 0.06em; }

.inline-example {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font-family: var(--mono); font-size: 0.92em;
  text-decoration: underline dotted; text-underline-offset: 3px;
}

/* --- command line ------------------------------------------------------- */
#command-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 6px 6px 14px;
}
#command-form:focus-within { border-color: var(--focus); outline: 1px solid var(--focus); }
.prompt { color: var(--accent); font-family: var(--mono); font-weight: 700; }
#command {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  font-family: var(--mono); font-size: 1rem; padding: 8px 0;
}
#command::placeholder { color: #6e7681; }
button[type="submit"], .actions button {
  background: #6e40c9; border: 0; color: #fff; border-radius: 7px;
  padding: 8px 16px; cursor: pointer; font-weight: 600;
}
button[type="submit"]:hover:not(:disabled) { background: #8957e5; }
button:disabled, input:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, .chip:focus-visible, .inline-example:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

.status { color: var(--muted); font-size: 0.9rem; min-height: 1.4em; margin: 8px 2px 0; }
.status.error { color: #ff938a; }

/* --- output ------------------------------------------------------------- */
.output-wrap { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.output-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 0.85rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions button { background: #21262d; padding: 4px 10px; font-weight: 500; font-size: 0.82rem; }
.actions button:hover:not(:disabled) { background: #30363d; }
.output {
  margin: 0; padding: 16px 14px; min-height: 160px; max-height: 70vh;
  overflow: auto; font-family: var(--mono); font-size: 14px; line-height: 1.15;
  white-space: pre; tab-size: 4;
}

/* --- examples ----------------------------------------------------------- */
.group { margin-bottom: 14px; }
.group h3 { margin: 0 0 6px; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 5px 12px; margin: 0 6px 6px 0; cursor: pointer;
  font-family: var(--mono); font-size: 0.82rem;
}
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

/* --- image box ---------------------------------------------------------- */
.image-box p { color: var(--muted); margin: 0 0 10px; }
#image-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#image-form label { color: var(--muted); font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
#image-width {
  width: 76px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px;
}
#image-file { max-width: 100%; color: var(--muted); font-size: 0.9rem; }
#image-file::file-selector-button {
  background: #21262d; color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 12px; margin-right: 10px; cursor: pointer; font: inherit;
}
#image-file:disabled::file-selector-button { cursor: not-allowed; }

footer {
  max-width: 860px; margin: 0 auto; padding: 18px 16px 40px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line);
}

@media (max-width: 520px) {
  main { padding-left: 12px; padding-right: 12px; }
  #command-form { padding-left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo, .subtitle { animation: none; }
}
