/* Same look as the Backwoods Simracer pages on diego-g.com, so the tool fits in there. */
:root {
  --bg: #ffffff;
  --surface: #f6f6f4;
  --fg: #1a1a1a;
  --muted: #5f5f5f;
  --border: #e3e3e0;
  --accent: #b84a00;
  --accent-soft: rgba(255, 126, 1, 0.12);
  --warn: #9a5b00;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111213;
    --surface: #1a1b1d;
    --fg: #ececec;
    --muted: #a0a0a0;
    --border: #2b2c2f;
    --accent: #ff7e01;
    --warn: #f0a050;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.6 var(--font);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; padding-bottom: 3rem; }
h1, h2 { line-height: 1.25; }
h1 { font-size: 2rem; margin: 2.5rem 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.5rem; }
a { color: var(--accent); }
code { font-family: var(--font-mono); font-size: 0.9em; }
.container { width: 100%; max-width: 52rem; margin: 0 auto; padding: 0 16px; }

/* Header and footer, as on the site. */
.site-header { border-top: 4px solid var(--accent); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding-block: 1rem; }
.site-title { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--fg); font-weight: 700; text-decoration: none; }
.site-title img { width: 1.75rem; height: 1.75rem; border-radius: 0.375rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }
.site-footer a { color: inherit; }

.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.5rem; }
.steps { padding-left: 1.25rem; margin: 0 0 0.5rem; }
.steps li { margin: 0.25rem 0; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0 0; }

/* The builder. */
.tabs { display: flex; gap: 0.375rem; margin: 2rem 0 -1px; }
.tab {
  border: 1px solid var(--border); border-bottom: none; background: transparent; color: var(--muted);
  padding: 0.55rem 1rem; border-radius: 8px 8px 0 0; cursor: pointer; font: inherit;
}
.tab.on { background: var(--surface); color: var(--fg); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 0 8px 8px 8px; padding: 1.25rem; }
label.f, legend.f { display: block; font-weight: 600; margin: 0.9rem 0 0.25rem; padding: 0; }
#t-csv > label.f:first-child, #t-random > label.f:first-child { margin-top: 0; }
select, input[type=text], input[type=number] {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.55rem;
}
select, input[type=text] { width: 100%; }
input[type=number] { width: 5.5rem; }
input[type=file] { margin-top: 0.5rem; max-width: 100%; }
.styles { border: 0; margin: 1rem 0 0; padding: 0; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.styles legend { width: 100%; }
.styles label { flex: 1; min-width: 14rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; cursor: pointer; background: var(--bg); }
.styles label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.styles input { margin-right: 0.4rem; accent-color: var(--accent); }
.styles small { display: block; color: var(--muted); margin-left: 1.4rem; }
.row { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; flex-wrap: wrap; }
.row select { flex: 1; min-width: 12rem; }
.row .models { color: var(--muted); font-size: 0.85rem; min-width: 4.5rem; }
button.x, button.add {
  border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 6px; padding: 0.35rem 0.65rem; cursor: pointer; font: inherit;
}
button.add { border-style: dashed; color: var(--fg); margin-top: 0.25rem; }
.total { color: var(--muted); margin: 0.6rem 0 0; }
.total.warn { color: var(--warn); }
.go { margin-top: 1.25rem; display: flex; justify-content: flex-end; }
.go button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 0.65rem 1.25rem; font: inherit; font-weight: 600; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .go button { color: #111213; } }
.go button:disabled { opacity: 0.5; cursor: default; }

.done { margin-top: 1.5rem; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 1rem 1.25rem; }
.done ol { margin: 0; padding-left: 1.25rem; }
.done h2 { word-break: break-word; }
.log {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-top: 1rem;
  max-height: 20rem; overflow: auto; white-space: pre-wrap; font: 0.8rem/1.5 var(--font-mono);
}
.log.error { border-color: var(--warn); color: var(--warn); }

/* Instructions under the builder. */
.crumbs { margin: 1.5rem 0 0; font-size: 0.9rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs + h1 { margin-top: 0.5rem; }
.docs { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.docs h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
.docs h2:first-child { margin-top: 0; }
.docs .steps li { margin: 0.4rem 0; }
.note { padding: 0.75rem 1rem; border-left: 4px solid var(--accent); border-radius: 0.25rem; background: var(--accent-soft); }
details { border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.6rem 0.9rem; margin: 0.5rem 0; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 0.5rem 0 0.25rem; }
/* The "Use your own CSV" toggle in the builder isn't a help box. */
.own { border: 0; padding: 0; margin: 1rem 0 0; }
.own summary { font-weight: 400; color: var(--accent); }
