:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #eeebe5;
  --text: #1c1b19;
  --muted: #66625a;
  --line: #ddd8cf;
  --accent: #3d675d;
  --accent-text: #ffffff;
  --accent-soft: #e1ece8;
  --ok: #2f6b3a;
  --ok-soft: #e2f0e4;
  --bad: #9a2a1d;
  --bad-soft: #f8e1dc;
  --focus: #4f8577;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121413;
    --surface: #1a1d1c;
    --surface-2: #232726;
    --text: #e8e6e1;
    --muted: #a09d95;
    --line: #333836;
    --accent: #86b8aa;
    --accent-text: #0d1513;
    --accent-soft: #22322e;
    --ok: #8fd19b;
    --ok-soft: #1f3324;
    --bad: #f0a091;
    --bad-soft: #3d221d;
    --focus: #9fd0c2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121413; --surface: #1a1d1c; --surface-2: #232726; --text: #e8e6e1; --muted: #a09d95; --line: #333836;
  --accent: #86b8aa; --accent-text: #0d1513; --accent-soft: #22322e; --ok: #8fd19b; --ok-soft: #1f3324;
  --bad: #f0a091; --bad-soft: #3d221d; --focus: #9fd0c2; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

header.site { padding: 40px 0 20px; }
h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.01em; }
.lede { margin: 0; max-width: 70ch; color: var(--muted); }
footer.site { color: var(--muted); font-size: 13px; padding-top: 24px; padding-bottom: 40px; }

/* the title screen's logo band, on its own dark backdrop */
.hero-logo {
  display: flex; align-items: center; justify-content: center;
  background: #050505;
  height: 150px; padding: 14px 20px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 18px;
}
.hero-logo img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 50% 50%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 75% at 50% 50%, #000 55%, transparent 100%);
}

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 0; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.panel { display: grid; gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.step h2 { margin: 0 0 4px; font-size: 17px; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

.discs { display: grid; gap: 10px; }
.drop {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-2);
  cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-label { font-weight: 600; display: grid; }
.serial { font-weight: 400; font-size: 12px; color: var(--muted); }
.file-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.drop-action { color: var(--accent); font-weight: 600; font-size: 13px; }
.badge { font-size: 12px; border-radius: 999px; padding: 2px 10px; }
.badge:empty { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.wait { background: var(--surface); color: var(--muted); }

.field-row { display: flex; gap: 10px; align-items: end; margin-bottom: 8px; }
.field-row label { flex: 1; display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
.mono { font-family: var(--mono); font-size: 14px; }
button { font: inherit; }
button.ghost, a.download {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
}
button.primary, a.download.primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 22px;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }

.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; min-width: 0; }
.group.wide { grid-column: 1 / -1; }
.group legend { padding: 0 4px; }
.group-body { display: grid; gap: 8px; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 3px; }
.master { font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ctl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ctl select { max-width: 240px; }
.num { width: 80px; }
.suffix { color: var(--muted); font-size: 13px; white-space: nowrap; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.group :disabled + * { color: var(--muted); }

.go-row { display: flex; align-items: center; gap: 14px; }
.bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.status { margin-top: 10px; font-size: 13px; color: var(--muted); font-family: var(--mono); overflow-wrap: anywhere; }
.results { margin-top: 14px; }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.disc-out { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.out-name { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.downloads .size { margin-left: 8px; opacity: 0.8; font-weight: 400; }
.spoiler {
  max-height: 420px; overflow: auto; background: var(--surface-2); border-radius: 8px; padding: 12px;
  font: 12px/1.45 var(--mono); white-space: pre;
}
details summary { cursor: pointer; color: var(--muted); }

@media (max-width: 720px) {
  .hero-logo { height: 110px; }
  .groups { grid-template-columns: 1fr; }
  .drop { grid-template-columns: 1fr auto; }
  .drop .file-name { grid-column: 1 / -1; grid-row: 2; }
  .field-row { flex-wrap: wrap; }
  .row { flex-wrap: wrap; }
}
