:root {
  --fg: #1f2328;
  --fg-muted: #6e7681;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --border: #d0d7de;
  --accent: #0969da;
  --accent-fg: #ffffff;
  --code-bg: #f6f8fa;
  --code-fg: #1f2328;
  --tag-latest: #2da44e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6edf3;
    --fg-muted: #8b949e;
    --bg: #0d1117;
    --bg-soft: #161b22;
    --border: #30363d;
    --accent: #58a6ff;
    --accent-fg: #0d1117;
    --code-bg: #161b22;
    --code-fg: #e6edf3;
    --tag-latest: #3fb950;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

header, main, footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

header {
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 2rem;
}

.tagline {
  color: var(--fg-muted);
  margin: 0 0 0.5rem 0;
}

.badges img {
  vertical-align: middle;
}

.badges a {
  margin-right: 0.75rem;
}

section {
  margin-bottom: 2.5rem;
}

/* Quick-start: prose label + action(s) on a single flex row.
   Wraps below the breakpoint, so it still looks fine on mobile. */
.qs-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}
.qs-line > span {
  flex: 0 1 auto;
}
.qs-line > code {
  flex: 1 1 20rem;
  padding: 0.5rem 0.75rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  overflow-x: auto;
}

section h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

code, pre, textarea {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

code {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding: 0;
}

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

a:hover {
  text-decoration: underline;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  font-size: inherit;
}

.button:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.button.secondary {
  background: var(--bg-soft);
  color: var(--accent);
}

.button[disabled],
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  color: var(--fg-muted);
  font-size: 0.95em;
}

.filters {
  margin: 1rem 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

select, input, textarea {
  font-family: inherit;
  font-size: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
}

textarea {
  width: 100%;
  resize: vertical;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: var(--bg-soft);
  font-weight: 600;
}

.row-latest {
  background: rgba(63, 185, 80, 0.06);
}

/* "Embed in your project" section: keep badge previews on their own
   line with a hair of vertical space. */
.badge-row {
  margin: 0.75rem 0;
}
.badge-row img {
  vertical-align: middle;
}

.tag {
  display: inline-block;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  font-size: 0.8em;
  background: var(--tag-latest);
  color: white;
  margin-left: 0.4em;
  vertical-align: middle;
}

.notes {
  color: var(--fg-muted);
  font-size: 0.9em;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab {
  background: transparent;
  color: var(--fg);
  border: 1px solid transparent;
  border-bottom: none;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  position: relative;
  top: 1px;
}

.tab.active {
  background: var(--bg);
  border-color: var(--border);
  font-weight: 600;
}

.tabpanel {
  display: none;
}

.tabpanel.active {
  display: block;
}

form label {
  display: block;
  margin: 0.6rem 0;
}

form label input,
form label select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
}

/* Side-by-side form rows. Stack on narrow screens via flex-wrap. */
form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
form .row > label {
  /* Default each cell to a sensible minimum so it doesn't collapse. */
  flex: 1 1 16rem;
}
/* Image picker shrinks to fit its short content rather than stretching
   to fill the row. Don't force-grow it; let neighbours take the slack. */
form label.image-pick {
  flex: 0 0 auto;
}
form label.image-pick select {
  width: auto;
  min-width: 12rem;
}
form label.grow { flex: 1 1 16rem; }

/* Branch is a short identifier; Path is a long sub-path. Bias the
   shared row so Branch takes only what it needs and Path gets the
   rest. Stacks below the 16rem floor on narrow screens. */
form label.branch { flex: 0 1 12rem; }

/* Image dropdown should visually match the text input next to it. The
   `<select>` and `<input>` have slightly different default vertical
   metrics; set a single line-height + box-sizing so they line up. */
form label.image-pick select,
form .row input[type="url"],
form .row input[type="text"] {
  height: 2.25rem;
  box-sizing: border-box;
}

/* Badge action row: preview, copy button, and the why-redirector
   <details> all live on one line to save vertical space. The
   <details> grows to fill remaining width so its expanded panel
   wraps nicely beneath. */
.badge-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.badge-actions details {
  flex: 1 1 16rem;
  margin-top: 0;
}
.badge-actions img {
  vertical-align: middle;
}

/* "Why does this go through /launch/?" — collapsed by default; the
   one-line summary preserves vertical space without losing the link. */
details {
  margin-top: 0.5rem;
}
details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9em;
}
details[open] > summary {
  margin-bottom: 0.25rem;
}
details > p {
  margin: 0.25rem 0 0 0;
}

.output {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
}

.actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

footer {
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9em;
}
