/* ArduPilot starting parameters. Colours are the other tools' tokens, so the
   platform reads as one; the chart's single series is the validated blue. */

:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --good-ink: #006300; --warning-ink: #8a5a00; --critical-ink: #b3261e; --critical: #d03b3b;
  --accent: #2a78d6; --focus: #2a78d6;
  --grid: #e1e0d9; --axis: #c3c2b7; --series-1: #2a78d6;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 8px rgba(11, 11, 11, 0.04);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --border: rgba(255, 255, 255, 0.10);
    --good-ink: #0ca30c; --warning-ink: #fab219; --critical-ink: #e66767;
    --accent: #3987e5; --focus: #6da7ec;
    --grid: #2c2c2a; --axis: #383835; --series-1: #3987e5; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --border: rgba(255, 255, 255, 0.10);
  --good-ink: #0ca30c; --warning-ink: #fab219; --critical-ink: #e66767;
  --accent: #3987e5; --focus: #6da7ec;
  --grid: #2c2c2a; --axis: #383835; --series-1: #3987e5; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font);
             font-size: 14px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
body.loading .layout { visibility: hidden; }
a { color: var(--accent); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
          flex-wrap: wrap; padding: 10px 20px; background: var(--surface);
          border-bottom: 1px solid var(--border); }
.back { color: var(--accent); text-decoration: none; white-space: nowrap; }
.back:hover { text-decoration: underline; }
.brand h1 { font-size: 16px; font-weight: 650; margin: 0; }
.subtitle { margin: 0; color: var(--ink-2); font-size: 13px; }
.actions { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; border: 1px solid var(--border);
       background: var(--surface); border-radius: 8px; padding: 5px 11px; cursor: pointer;
       white-space: nowrap; text-decoration: none; color: inherit; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }

.layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px;
          padding: 16px 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; padding: 12px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 6px; }
.results { display: grid; gap: 16px; min-width: 0; }
.form { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow: auto; }
@media (max-width: 900px) { .form { position: static; max-height: none; } }
fieldset { border: 0; margin: 12px 0 0; padding: 0; min-width: 0; }
legend, label { font-weight: 600; font-size: 13px; padding: 0; }
fieldset.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.two label { display: block; }
input:not([type=checkbox]):not([type=range]), select {
  width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input[type=number] { width: 90px; flex: none; }
.row input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent); }
.invalid { border-color: var(--critical) !important; }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.caution { color: var(--warning-ink); font-size: 12.5px; margin: 6px 0 0; }
.muted { color: var(--ink-2); margin: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 99px;
            padding: 3px 10px; cursor: pointer; font-size: 13px; }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.checks .check { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; font-weight: 600;
                 cursor: pointer; }
.checks .check input { transform: translateY(2px); }
.checks .hint { margin-left: 24px; }
.copter-bar { margin-top: 12px; }
.copter-bar .voko-copter select { width: auto; margin-top: 0; }
.copter-notes { margin: 6px 0 0; padding-left: 18px; color: var(--warning-ink); font-size: 12.5px; }
.copter-notes li { margin: 2px 0; }
.error-box { margin-top: 10px; padding: 8px 10px; border-radius: 8px; color: var(--critical-ink);
             border: 1px solid var(--critical); }

.results-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
                align-items: flex-start; }
.group h3 { font-size: 13.5px; margin: 16px 0 4px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table th, .table td { text-align: left; vertical-align: top; padding: 6px 8px;
                       border-bottom: 1px solid var(--border); }
.table th { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.mono { font-family: var(--mono); }
.params td.name { white-space: nowrap; font-weight: 600; }
.params td.value { white-space: nowrap; }
.reboot { color: var(--muted); font-weight: 400; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12px; }
.source { color: var(--muted); }
.source-estimate { color: var(--warning-ink); }
.formula { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.after { margin: 4px 0 0; padding-left: 20px; }
.after li { margin: 4px 0; }
.guide-link { white-space: nowrap; }
#am32 td.value { white-space: nowrap; font-weight: 600; }
#am32 .gloss { display: block; color: var(--ink-2); font-size: 12px; }
.tag { margin-left: 6px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2);
       border-radius: 99px; padding: 0 7px; white-space: nowrap; }
.sources ul { margin: 4px 0 0; padding-left: 18px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
          margin-top: 8px; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { font-size: 13px; margin-bottom: 4px; }
svg.plot { width: 100%; height: auto; display: block; overflow: visible; }
svg.plot .grid { stroke: var(--grid); stroke-width: 1; }
svg.plot .tick, svg.plot .axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.plot .series { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; }
svg.plot .you { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
svg.plot .crosshair { stroke: var(--axis); stroke-width: 1; }
svg.plot .hit { fill: transparent; cursor: crosshair; }
.tooltip { position: fixed; z-index: 30; pointer-events: none; background: var(--surface);
           border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12.5px;
           box-shadow: var(--shadow); font-variant-numeric: tabular-nums; }

.about { padding: 4px 20px 24px; color: var(--muted); font-size: 12.5px; }
.about a { color: var(--ink-2); }
@media (max-width: 900px) { .about { padding: 4px 12px 20px; } }
.actions select { width: auto; margin-top: 0; padding: 5px 8px; }

/* On a phone each row is a small card: name and value, the reason below. */
@media (max-width: 600px) {
  .params thead, #am32 thead { display: none; }
  .params tr, #am32 tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
                         padding: 8px 0; border-bottom: 1px solid var(--border); }
  .params td, #am32 td { padding: 0; border: 0; }
  .params td:nth-child(3), #am32 td:nth-child(3) { grid-column: 1 / -1; color: var(--ink-2); }
  .params td.name { overflow-wrap: anywhere; white-space: normal; }
}
