/* Overpass Predictor -- hosted browser build.
   Same skeleton as the Ship Finder and Depth previews on purpose, so the
   tools read as one family: map left, everything you can change on the right.

   Note there is not a single inline style= attribute in index.html, and there
   cannot be: the site serves style-src 'self', which silently refuses inline
   style attributes in production while a plain local http.server sends no CSP
   at all and renders them fine. Every rule lives here. CSSOM assignment
   (el.style.x = y) is exempt and is what app.js uses. */

:root {
  --ink: #0f1417;
  --dim: #5b6b74;
  --line: #d8e0e4;
  --bg: #f6f8f9;
  --card: #fff;
  --sea: #124e6e;
  --sea-ink: #fff;
  --warn-bg: #fff4e5;
  --warn-line: #f0c48a;
  --warn-ink: #6b4310;
  --good: #1a7f37;
  --bad: #b3261e;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

/* build.py splices .hosted-bar in right after <body>. An app whose wrapper is
   position:fixed;inset:0 covers that bar completely and the link back to the
   site becomes unreachable. So: body is the flex column, the bar takes its
   natural height, and .app takes the rest. Capped at 20vh because the bar's
   note wraps and a long one once took 126px of a 225px viewport. */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > .hosted-bar { flex: 0 0 auto; max-height: 20vh; overflow: auto; }
.app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* Definite height above the breakpoint, not just min-height: with min-height
   alone the body is free to grow, a long pass list stretches the row, and the
   map faithfully follows it far below the fold. Ship Finder learned this the
   hard way and the comment is worth keeping. */
@media (min-width: 861px) {
  body { height: 100vh; }
}

h1 { margin: 0; font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
h3 {
  margin: 0 0 6px; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim);
}
h3.mt { margin-top: 18px; }
a { color: var(--sea); }
code { font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; }

.topbar {
  flex: 0 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: flex-start; }
.brand p { margin: 4px 0 0; color: var(--dim); font-size: 0.83rem; max-width: 62ch; }
.tag {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--sea); color: var(--sea-ink); padding: 2px 6px;
  border-radius: 4px; vertical-align: 3px;
}

.ghost {
  flex: 0 0 auto;
  background: transparent; border: 1px solid var(--line); color: var(--dim);
  border-radius: var(--radius); padding: 6px 12px; font-size: 0.8rem; cursor: pointer;
}
.ghost:hover { border-color: var(--sea); color: var(--sea); }

.notice {
  flex: 0 0 auto; margin: 0;
  padding: 8px 16px; font-size: 0.8rem;
  background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: var(--warn-ink);
}

.help {
  flex: 0 0 auto; margin: 0; padding: 12px 16px; max-height: 42vh; overflow: auto;
  background: var(--card); border-bottom: 1px solid var(--line); font-size: 0.86rem;
}
.help p { margin: 0 0 10px; max-width: 76ch; }
.help p:last-child { margin-bottom: 0; }

.wrap { flex: 1 1 auto; min-height: 0; display: flex; }
#map { flex: 1 1 auto; min-width: 0; height: 100%; background: #dfe6ea; }

.side {
  flex: 0 0 340px; height: 100%; overflow-y: auto;
  background: var(--card); border-left: 1px solid var(--line); padding: 14px;
}

label { display: block; font-size: 0.72rem; color: var(--dim); margin: 10px 0 4px; }
input[type=text], input[type=number], select {
  width: 100%; padding: 6px 8px; font-size: 0.86rem;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.row { display: flex; gap: 8px; }
.row > div { flex: 1 1 0; min-width: 0; }
.hint { margin: 6px 0 0; font-size: 0.72rem; color: var(--dim); }

.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button {
  background: #eef2f4; border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 4px 10px; font-size: 0.76rem; cursor: pointer;
}
.presets button:hover { border-color: var(--sea); }

.selected {
  margin-top: 8px; padding: 7px 9px; border-radius: 6px;
  background: #eef7f0; border: 1px solid #cfe6d6; color: var(--good);
  font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; word-break: break-word;
}

.check { display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.check label { margin: 0; font-size: 0.8rem; color: var(--ink); }

button.primary {
  width: 100%; margin-top: 14px; padding: 10px;
  background: var(--sea); color: var(--sea-ink); border: 0;
  border-radius: var(--radius); font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
button.primary:hover { background: #0d3c55; }
button.primary:disabled { background: #c3ccd1; cursor: default; }

.status { margin-top: 8px; font-size: 0.78rem; color: var(--dim); min-height: 1.2em; }
.status.err { color: var(--bad); }

#results { margin-top: 14px; }
.summary {
  padding: 9px 10px; border-radius: 6px; background: #eef2f4;
  border: 1px solid var(--line); font-size: 0.8rem; margin-bottom: 10px;
}
.summary b { color: var(--ink); }

.best {
  border: 1px solid #bfe0c8; background: #f1f9f3; border-radius: 6px;
  padding: 9px 10px; margin-bottom: 10px; font-size: 0.78rem;
}
.best .lbl {
  display: block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--good); margin-bottom: 3px;
}

.day {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--dim); margin: 12px 0 5px; border-bottom: 1px solid var(--line); padding-bottom: 3px;
}

.pass {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; margin-bottom: 6px; font-size: 0.76rem; cursor: pointer;
}
.pass:hover { border-color: var(--sea); }
.pass.on { border-color: #d29922; background: #fdf6e6; }
.pass.best-row { border-color: #1a7f37; }
.best.pass { cursor: pointer; }
.pass .t { font-family: ui-monospace, Menlo, Consolas, monospace; }
.pass .sat { color: var(--sea); font-weight: 600; }
.pass .meta { color: var(--dim); }
.pass .ok { color: var(--good); }
.pass .no { color: var(--dim); }
.pass .task {
  float: right; background: transparent; color: var(--good);
  border: 1px solid #bfe0c8; border-radius: 5px;
  padding: 1px 8px; font-size: 0.68rem; cursor: pointer;
}
.pass .task:hover { background: #eaf5ed; }

.order {
  border: 1px solid #bfe0c8; background: #f7fbf8;
  border-radius: 6px; padding: 10px; margin-top: 8px;
}
.order pre {
  margin: 0; font: 10.5px/1.45 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.order .brev {
  margin-top: 8px; padding: 7px 8px; background: #eef2f4;
  border: 1px solid var(--line); border-radius: 5px;
  font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
  color: var(--good); word-break: break-all;
}
.order .btns { display: flex; gap: 6px; margin-top: 8px; }
.order .btns button {
  flex: 1 1 0; background: #eef2f4; border: 1px solid var(--line);
  border-radius: 5px; padding: 5px; font-size: 0.7rem; cursor: pointer;
}
.order .btns button:hover { border-color: var(--good); }
.order .warn { color: var(--warn-ink); font-size: 0.72rem; margin-top: 6px; }

/* Legend, mirroring GroundFi's density legend so the two read alike. */
.legend {
  background: rgba(255,255,255,0.94); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font-size: 0.68rem; line-height: 1.45;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.legend b { font-size: 0.66rem; letter-spacing: 0.05em; }
.legend .sw {
  display: inline-block; width: 15px; height: 10px; margin-right: 6px;
  vertical-align: -1px; border: 1px solid rgba(0,0,0,0.25);
}
.legend .note { color: var(--dim); }

.verdict { font-size: 0.8rem; }
.verdict b.good { color: var(--good); }
.verdict b.bad { color: var(--bad); }
.verdict .sub { color: var(--dim); font-size: 0.72rem; }

@media (max-width: 860px) {
  .wrap { display: block; }
  #map { height: 58vh; }
  .side { flex: none; width: auto; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .brand p { max-width: none; }
}
