:root {
  color-scheme: light dark;
  font-family: system-ui, sans-serif;
  color: #171717;
  background: transparent;
  font-synthesis: none;
  --muted: #606060;
  --button: #171717;
  --button-text: #fff;
  --track: #dedede;
  --error: #a51d24;
}
* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: transparent; }
/* Auto margins center short embeds without clipping content in shorter frames. */
main { flex-shrink: 0; width: 100%; max-width: 620px; margin: auto; padding: 24px; }
.intro { margin-bottom: 24px; }
h1 { font-size: clamp(1.5rem, 5vw, 1.875rem); font-weight: 650; letter-spacing: -.035em; line-height: 1.2; margin: 0; }
h2 { margin: 0; font-size: 1.125rem; font-weight: 600; line-height: 1.5; }
.converter { background: transparent; }
/* The instructions size this shared area, so results never grow the embed. */
.content { display: grid; margin-bottom: 20px; }
.instructions, #result { grid-area: 1 / 1; min-width: 0; }
.content:has(#result:not([hidden])) .instructions { visibility: hidden; }
#result { contain: size; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
.hint { color: var(--muted); font-size: .9375rem; line-height: 1.6; margin: 10px 0 0; }
code { font-size: .9em; overflow-wrap: anywhere; }
button { font: inherit; cursor: pointer; }
.primary { display: inline-flex; align-items: center; justify-content: center; padding: 11px 18px; border: 1px solid var(--button); border-radius: 5px; background: var(--button); color: var(--button-text); font: inherit; font-weight: 600; text-decoration: none; line-height: 1.5; }
.actions > .primary { flex: 1; min-width: 0; white-space: nowrap; }
.primary:hover { opacity: .8; }
.primary:disabled { opacity: .45; cursor: wait; }
summary { cursor: pointer; font-size: .875rem; font-weight: 600; line-height: 1.5; }
a { color: inherit; text-underline-offset: 3px; }
.status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
#status { margin: 0 0 10px; line-height: 1.5; overflow-wrap: anywhere; font-weight: 600; }
.text-button { flex-shrink: 0; background: transparent; border: 0; color: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.counts { font-size: .875rem; color: var(--muted); line-height: 1.5; margin: 8px 0; }
progress { display: block; width: 100%; height: 4px; accent-color: var(--button); border: 0; border-radius: 2px; overflow: hidden; background: var(--track); }
progress::-webkit-progress-bar { background: var(--track); }
progress::-webkit-progress-value { background: var(--button); }
progress::-moz-progress-bar { background: var(--button); }
.actions { display: flex; gap: 12px; }
#issues { margin-top: 12px; }
#issue-list { padding-left: 20px; font-size: .875rem; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
#issue-list li + li { margin-top: 8px; }
.error { color: var(--error); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root { color: #f5f5f5; --muted: #b3b3b3; --button: #f5f5f5; --button-text: #171717; --track: #444; --error: #ff9298; }
}
@media (max-width: 480px) {
  main { padding: 16px; }
  .actions > .primary { font-size: .875rem; padding-inline: 8px; }
}

/* Replace each step in place; the metadata step fits a 300px embed. */
main { padding: 12px 18px; }
.intro { margin-bottom: 8px; }
h1 { font-size: 1.5rem; }
.content { margin-bottom: 10px; }
.content:has(#metadata:not([hidden])) { display: block; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.fields label { display: flex; flex-direction: column; min-width: 0; gap: 2px; font-size: .75rem; line-height: 1; font-weight: 600; }
.fields label span { font-weight: 400; color: var(--muted); }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields select, .fields textarea { width: 100%; min-width: 0; height: 25px; padding: 3px 7px; border: 1px solid var(--track); border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: .875rem; }
.fields textarea { resize: none; }
.fields select option { color: CanvasText; background: Canvas; }
#metadata-error { margin: 6px 0 0; font-size: .75rem; line-height: 1.2; }
.primary { padding: 7px 14px; font-size: .875rem; }
.actions { align-items: center; }
@media (max-width: 480px) {
  main { padding: 10px 12px; }
  .fields { gap: 5px 8px; }
  .fields label span { display: none; }
}
