:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #5b6470;
  --line: #dfe3e8;
  --accent: #b4231f;
  --accent-ink: #ffffff;
  --ok: #1c6b3c;
  --ok-bg: #e8f5ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --error: #a11a16;
  --error-bg: #fdeceb;
  --code: #eef1f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --panel: #1c2024;
    --ink: #e8eaed;
    --muted: #98a2ae;
    --line: #2c3238;
    --accent: #e04a44;
    --accent-ink: #14171a;
    --ok: #6fd39b;
    --ok-bg: #16301f;
    --warn: #e0b060;
    --warn-bg: #332713;
    --error: #f28b86;
    --error-bg: #331917;
    --code: #23282d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

main { max-width: 46rem; margin: 0 auto; }

header { margin-bottom: 2rem; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; letter-spacing: .01em; }

.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 .75rem; }

.release {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel.warn { border-color: var(--warn); background: var(--warn-bg); }
.panel.blocked { border-color: var(--error); }

p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

ol { margin: 0; padding-left: 1.25rem; }
li { margin-bottom: .5rem; }
li:last-child { margin-bottom: 0; }

a { color: var(--accent); }

code {
  background: var(--code);
  padding: .1em .35em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}

.row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }

button {
  font: inherit;
  font-weight: 600;
  padding: .6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--muted); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

button:disabled { opacity: .45; cursor: not-allowed; }

.status {
  margin: 0;
  padding: .7rem .9rem;
  border-radius: 8px;
  background: var(--code);
  font-size: .95rem;
  white-space: pre-wrap;
}

.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.error { background: var(--error-bg); color: var(--error); }

.progress {
  margin-top: .9rem;
  height: 1.4rem;
  background: var(--code);
  border-radius: 8px;
  overflow: hidden;
}

.bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
  transition: width .2s ease;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.2rem;
  margin: 0;
  font-size: .95rem;
}

dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }

.log {
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  background: var(--code);
  border-radius: 8px;
  padding: .8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.fine { font-size: .87rem; color: var(--muted); }

footer {
  margin-top: 2rem;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 30rem) {
  dl { grid-template-columns: 1fr; gap: .1rem; }
  dt { margin-top: .5rem; }
}

/* Facsimile of the browser's serial-port chooser, so people know which entry
   is theirs before the real dialog appears. Deliberately generic: the trailing
   device digits differ on every machine. */
.picker {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code);
  padding: 1rem;
  max-width: 30rem;
}

.picker-title {
  font-weight: 650;
  font-size: .92rem;
  margin-bottom: .8rem;
}

.picker-list {
  list-style: none;
  margin: 0 0 .9rem;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.picker-list li {
  margin: 0;
  padding: .55rem .7rem;
  font-size: .88rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.picker-list li:last-child { border-bottom: 0; }

.picker-list .pick {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.pick-tag {
  font-family: inherit;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .85;
  white-space: nowrap;
}

.picker-buttons {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

.picker-btn {
  font-size: .82rem;
  padding: .35rem .9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.picker-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.speed {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.speed select {
  font: inherit;
  padding: .35rem .5rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.speed .hint {
  font-size: .8rem;
  opacity: .8;
}

.speed input[type="checkbox"] { margin: 0; }
