/* SF Bay Swims — the Planner, on top of css/engine.css: the map with its HUD corners, the left panel (a bottom sheet on
   phones), the timeline strip along the bottom, the settings sheet. */
:root { --panel-w: 340px; --tl-h: 76px; --line: rgba(255, 255, 255, 0.14); --accent: #ffffff; --ink2: rgba(255, 255, 255, 0.78); }
html, body { overflow: hidden; }
body { font-size: 14px; letter-spacing: 0; text-transform: none; }
#map { left: var(--panel-w); bottom: var(--tl-h); }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 0.35em 0.7em; cursor: pointer; color: var(--ink2); }
button:hover { border-color: rgba(255, 255, 255, 0.4); color: var(--ink); }
button.on { background: rgba(255, 255, 255, 0.14); color: var(--ink); border-color: rgba(255, 255, 255, 0.4); }
input, select { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 6px; padding: 0.35em 0.5em; color: var(--ink); }
select option { background: #111; color: var(--ink); }
input[type=range] { padding: 0; accent-color: #fff; }
input[type=number] { width: 4.5em; }
a { color: var(--ink2); }
h2 { font-size: 0.78em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); margin: 0 0 0.5em; font-weight: 600; }
h3 { font-size: 0.85em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); margin: 1.2em 0 0.4em; }
.unit { color: var(--mute); font-size: 0.9em; }
.approx { color: var(--mute); }

/* HUD corners on the map */
.hud { position: absolute; z-index: 5; pointer-events: none; letter-spacing: 0.16em; text-transform: uppercase; background: var(--panel); padding: 0.8em 1.1em; font-size: 11px; }
.hud.tl { top: 12px; left: 12px; }
.hud.tr { top: 12px; right: 12px; text-align: right; }
.hud .wordmark { font-size: 0.95em; color: var(--mute); letter-spacing: 0.3em; margin-bottom: 0.35em; }
.hud .title, .hud .big { font-size: 1.3em; font-weight: 600; }
.hud .big + .big { margin-top: 0.3em; }
.hud .sub { font-size: 1em; color: var(--mute); margin-top: 0.45em; }
.hud .sub:empty, .hud .big:empty { display: none; }

/* the probe tag (the current under the pointer) */
#probe { position: absolute; z-index: 6; pointer-events: none; display: none; background: var(--panel); color: var(--ink); padding: 0.4em 0.7em; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; transform: translate(14px, 14px); }
#probe.on { display: block; }

/* the panel */
#panel { position: absolute; z-index: 7; top: 0; left: 0; bottom: var(--tl-h); width: var(--panel-w); background: rgba(8, 8, 8, 0.96); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
#panel .handle { display: none; }
#panel .body { overflow-y: auto; padding: 14px 16px 24px; flex: 1; }
#panel section { padding: 12px 0; border-bottom: 1px solid var(--line); }
#panel section:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; margin: 0.4em 0; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4em; }
.seg.steps button, .seg.presets button { padding: 0.3em 0.55em; font-size: 0.9em; }
.list { display: flex; flex-direction: column; gap: 0.25em; }
.list button { display: flex; justify-content: space-between; text-align: left; padding: 0.45em 0.7em; }
.list button .d { color: var(--mute); font-variant-numeric: tabular-nums; }
.dir { margin-top: 0.5em; }
.dir:empty { display: none; }
#start { flex: 1; min-width: 12em; }
details summary { cursor: pointer; color: var(--mute); font-size: 0.9em; margin-top: 0.3em; }
details .row { font-size: 0.9em; }
.result .route-name { font-size: 1.35em; font-weight: 600; margin: 0.1em 0 0.5em; }
.result .rows { display: flex; flex-direction: column; }
.result .r { display: flex; justify-content: space-between; gap: 1em; padding: 0.22em 0; }
.result .k { color: var(--mute); }
.result .v { font-variant-numeric: tabular-nums; text-align: right; }
.result .note { color: #ffb4a2; padding: 0.22em 0; }
.result em.warn { color: #ffd27a; font-style: normal; }
.result .note:empty, .result .win:empty { display: none; }
.result .preview { margin-top: 0.7em; }
.result .preview input { flex: 1; min-width: 6em; }
.tools { display: flex; gap: 0.5em; }
.tools button { flex: 1; }

/* legs, best starts, saved plans */
.result .notes { color: var(--mute); font-size: 0.9em; margin: -0.3em 0 0.5em; }
.result .notes:empty { display: none; }
#legs { width: 100%; border-collapse: collapse; font-size: 0.88em; font-variant-numeric: tabular-nums; }
#legs th { text-align: left; color: var(--mute); font-weight: 400; padding: 0.2em 0.3em; border-bottom: 1px solid var(--line); }
#legs td { padding: 0.25em 0.3em; border-bottom: 1px solid rgba(255, 255, 255, 0.06); white-space: nowrap; }
#legs td:first-child { white-space: normal; }
#legs tr.slow td { color: #ffd27a; } #legs tr.swept td { color: #ffb4a2; }
#legs tr:hover td { background: rgba(255, 255, 255, 0.06); }
.hint { color: var(--mute); font-size: 0.8em; margin-top: 0.4em; }
details .row.filters { gap: 1em; font-size: 0.9em; } .filters label { display: flex; align-items: center; gap: 0.3em; }
#bs-max { width: 4em; } #bs-cycles { width: 3.5em; } #bs-progress { flex: 1; height: 6px; }
.list button.bs, .list button.fav { display: grid; grid-template-columns: 1fr auto; gap: 0 0.8em; text-align: left; }
.list button.bs .rel, .list button.fav .d { grid-column: 1 / -1; color: var(--mute); font-size: 0.85em; }
.list button.bs em { color: #ffd27a; font-style: normal; }
.list button.bs.best .s { color: var(--ink); font-weight: 600; }
.list button.fav .x { color: var(--mute); }
#svg #speed .base { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
#svg #speed .swept { fill: none; stroke: rgba(255, 90, 60, 0.9); stroke-width: 2px; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
#svg #speed line { stroke-width: 3px; vector-effect: non-scaling-stroke; opacity: 0.85; stroke-linecap: round; }
#svg #speed.dim line { opacity: 0.25; } #svg #speed line.hi { opacity: 1; stroke-width: 6px; }
#tl .height { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 1; stroke-dasharray: 3 3; }

/* draw a swim */
.draw-tools { margin-top: 0.6em; }
#draw-bar { margin-top: 0.6em; padding: 0.6em; border: 1px dashed var(--line); border-radius: 8px; }
#draw-bar .warn { color: #ffb4a2; font-size: 0.9em; }
#draw-name { flex: 1; min-width: 8em; }
html.drawing #map { cursor: crosshair; }
html.drawing #probe { display: none; }
#svg #draw circle { fill: #fff; stroke: #000; stroke-width: 1.5px; cursor: grab; vector-effect: non-scaling-stroke; }
#svg #draw circle:active { cursor: grabbing; }
html.drawing #svg { touch-action: none; }

/* the timeline strip */
#timeline { position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; height: var(--tl-h); background: rgba(8, 8, 8, 0.96); border-top: 1px solid var(--line); touch-action: none; cursor: ew-resize; }
#tl { width: 100%; height: 100%; display: block; }
#tl text { font-size: 10px; fill: var(--mute); letter-spacing: 0.06em; }
#tl .night { fill: rgba(80, 100, 150, 0.22); }   /* civil dusk → dawn; visible on the dark strip */
#tl .flood { fill: rgba(120, 180, 255, 0.35); } #tl .ebb { fill: rgba(255, 150, 110, 0.35); }
#tl .zero { stroke: var(--line); }
#tl .slack { stroke: rgba(255, 255, 255, 0.35); }
#tl .swim { fill: rgba(255, 255, 255, 0.85); } #tl .swim.swept { fill: rgba(255, 90, 60, 0.9); }
#tl .now { stroke: rgba(255, 255, 255, 0.5); stroke-dasharray: 2 3; }
#tl .head { stroke: #fff; stroke-width: 2; }
#tl .head-t { fill: #fff; }

/* the footer line and the settings sheet */
#foot { position: absolute; z-index: 8; right: 12px; bottom: calc(var(--tl-h) + 8px); font-size: 11px; color: var(--mute); background: var(--panel); padding: 0.3em 0.6em; letter-spacing: 0.06em; }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet[hidden] { display: none; }
.sheet .card { background: #0c0c0c; border: 1px solid var(--line); border-radius: 10px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 18px 22px; line-height: 1.45; }
.sheet .head { display: flex; justify-content: space-between; align-items: center; }
.sheet .grid { display: grid; grid-template-columns: auto 1fr; gap: 0.6em 1em; align-items: center; margin: 0.6em 0; }
.sheet p { color: var(--ink2); margin: 0.5em 0; font-size: 0.95em; }
.keys { display: grid; grid-template-columns: auto 1fr; column-gap: 1.2em; row-gap: 0.25em; font-size: 0.92em; }
.keys span:nth-child(odd) { color: var(--ink); font-variant-numeric: tabular-nums; }
.keys span:nth-child(even) { color: var(--mute); }

.sheet textarea { width: 100%; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 6px; padding: 0.5em; color: var(--ink); resize: vertical; }
.sheet .row.foot { justify-content: space-between; margin-top: 1em; }
#banner { position: fixed; top: 0; left: 0; right: 0; z-index: 30; display: flex; gap: 0.6em; align-items: center; padding: 0.5em 0.9em; background: #5a1d14; color: #fff; font-size: 0.95em; }
#banner[hidden] { display: none; }
#banner span { flex: 1; }
#banner button { color: #fff; border-color: rgba(255, 255, 255, 0.4); padding: 0.2em 0.6em; }

/* switches */
html.no-streaks #particles { display: none; }

/* phones: the map on top, the timeline under it, the panel as a bottom sheet with a handle */
@media (max-width: 720px) {
  :root { --panel-w: 0px; --sheet-h: 46vh; }
  #map { left: 0; bottom: calc(var(--sheet-h) + var(--tl-h)); }
  #timeline { bottom: var(--sheet-h); }
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h); border-right: 0; border-top: 1px solid var(--line); transition: height 0.25s; }
  #panel .handle { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 0.92em; }
  html.panel-collapsed { --sheet-h: 44px; }
  html.panel-collapsed #panel .body { display: none; }
  #foot { display: none; }
  .hud { font-size: 10px; padding: 0.6em 0.8em; }
  .hud.tl { left: 8px; top: 8px; } .hud.tr { right: 8px; top: 8px; }
}
