/* DeepRacer Racing Line — light/dark aware, no build step. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --fg: #1a1d21;
  --muted: #6b7280;
  --grid: #e5e7eb;
  --edge: #111827;
  --accent: #d92d20;
  --accent-soft: #fee4e2;
  --border: #e3e6ea;
  --code-bg: #f8f9fb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --panel: #171b21;
    --fg: #e8eaed;
    --muted: #9aa3ae;
    --grid: #262c34;
    --edge: #cfd6de;
    --accent: #ff6a5e;
    --accent-soft: #3a1c1a;
    --border: #262c34;
    --code-bg: #12161b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

/* Wraps and shrinks rather than forcing the page to scroll sideways on a
   phone, where the search box and a 260px dropdown do not fit on one line. */
.picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  flex: 1 1 320px;
  justify-content: flex-end;
}

.picker input[type="search"] {
  flex: 1 1 150px;
  min-width: 0;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
}

.picker select {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 320px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
}

.picker input:focus, .picker select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.match-count { color: var(--muted); font-size: 11px; align-self: center; white-space: nowrap; }

/* ---------------------------------------------------------------- controls */

main { padding: 16px 20px 8px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.control { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.control-wide { flex: 1 1 300px; }
.control > label { font-size: 12px; font-weight: 600; color: var(--fg); }
.control-row { display: flex; align-items: center; gap: 6px; }
.control-value { color: var(--accent); font-variant-numeric: tabular-nums; }
.control-note { margin: 0; font-size: 11px; color: var(--muted); }
.control-note.is-warn { color: var(--accent); }
.control-reset { margin-left: auto; align-self: center; }

.control input[type="number"] {
  width: 76px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.control input[type="range"] { width: 100%; min-width: 160px; accent-color: var(--accent); }
.control input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.unit { color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------- stats */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  flex: 1 1 130px;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.stat-k { display: block; color: var(--muted); font-size: 11px; }
.stat-v { display: block; font-size: 17px; font-weight: 620; letter-spacing: -0.01em; }

/* ------------------------------------------------------------------ layout */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 { margin: 0; font-size: 14px; font-weight: 620; }

.plot-toggles { display: flex; gap: 12px; color: var(--muted); font-size: 12px; }
.plot-toggles label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.plot { width: 100%; height: 460px; }
.profile { height: 205px; border-top: 1px solid var(--border); }

/* -------------------------------------------------------------------- code */

.code-actions { display: flex; align-items: center; gap: 8px; }
.wp-step { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.wp-step select {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
}

.btn {
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--border); }

.code {
  margin: 0;
  padding: 14px;
  height: 640px;
  overflow: auto;
  background: var(--code-bg);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  tab-size: 4;
}

/* ------------------------------------------------------------------ chrome */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  z-index: 50;
}
.toast.is-error { background: var(--accent); color: #fff; }

.foot {
  padding: 14px 20px 22px;
  color: var(--muted);
  font-size: 11.5px;
}
.foot a { color: var(--muted); }
