/* The desktop's window (src/window.ts): three Panels between vertical
   separators, Panes under separators that carry their titles. The colors
   are the phone's until brand's contract for the desktop lands. */
:root {
  --ink: #fff;
  --dim: rgb(170, 180, 190);
  --panel: rgb(13, 25, 36);
  --band: rgb(8, 20, 31);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--band);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
#window {
  position: fixed;
  inset: 26px 0 0 0;
  display: grid;
  grid-template-columns: var(--left) 5px minmax(0, 1fr) 5px var(--right);
  background: var(--band);
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
}
#window .panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}
#window .panel.folded { visibility: hidden; }
#window .panel-sep {
  cursor: col-resize;
  background: rgba(255, 255, 255, 0.08);
  touch-action: none;
}
#window .panel-sep:hover { background: rgba(255, 255, 255, 0.22); }

/* A Pane: its separator, and under it, when expanded, what it holds. An
   expanded Pane that grows shares what height the Panel has left. */
#window .pane { display: flex; flex-direction: column; min-height: 0; flex: none; }
#window .pane.expanded.grows { flex: 1 1 0; }
/* What is left over goes to the Panes that can use it, so not to one that
   holds nothing yet. */
#window .pane.expanded.grows:has(> .pane-body:empty) { flex: none; }
#window .pane-sep {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  padding: 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  text-align: left;
  color: var(--dim);
}
#window .pane-sep:hover { color: var(--ink); }
#window .pane-tri {
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.1s;
}
#window .pane.expanded .pane-tri { transform: rotate(90deg); }
#window .pane-body { display: none; min-height: 0; overflow: auto; position: relative; }
#window .pane.expanded .pane-body { display: block; flex: 1 1 auto; }
#window .pane.expanded:not(.grows) .pane-body { max-height: 40vh; }
#window .pane-body:empty::before {
  content: "Not in the browser yet.";
  display: block;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--dim);
}

/* The Mode: two stops, the chosen one lit. */
#window .mode-switch { display: flex; justify-content: center; padding: 6px 8px; gap: 0; }
#window .mode-switch button {
  padding: 4px 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 13px;
}
#window .mode-switch button:first-child { border-radius: 12px 0 0 12px; }
#window .mode-switch button:last-child { border-radius: 0 12px 12px 0; border-left: none; }
#window .mode-switch button[aria-checked="true"] { background: rgba(120, 180, 255, 0.25); color: var(--ink); }

/* The Map's body is the map. */
#window .pane[data-id="map"] .pane-body { overflow: hidden; }

/* The menu bar over the window, and the status of what is being read. */
#menubar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  background: var(--band);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}
#menubar > button { padding: 2px 8px; border-radius: 3px; }
#menubar > button:hover { background: rgba(255, 255, 255, 0.12); }
#menubar .switch { margin-left: auto; padding: 2px 8px; color: var(--dim); text-decoration: none; white-space: nowrap; }
#menubar .switch:hover { color: inherit; text-decoration: underline; }
#menubar .status { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-pop {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 4px 0;
  background: rgb(28, 40, 52);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-size: 13px;
}
.menu-pop button { padding: 5px 16px; text-align: left; }
.menu-pop button:hover { background: rgba(120, 180, 255, 0.25); }

/* Browse: the List's tab, the search, and the rows in sight. */
#window .pane[data-id="browse"] .pane-body { overflow: hidden; }
.browse { display: flex; flex-direction: column; height: 100%; font-size: 12px; }
.browse-tabs { display: flex; gap: 2px; padding: 4px 6px 0; }
.browse-tabs button { padding: 2px 10px; border-radius: 3px 3px 0 0; color: var(--dim); }
.browse-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.browse-find { display: flex; align-items: center; gap: 4px; padding: 4px 6px; }
.browse-find input {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
.browse-find .caret { padding: 0 4px; color: var(--dim); }
.browse-count { color: var(--dim); min-width: 4em; }
.browse-list { flex: 1; min-height: 0; overflow: auto; outline: none; }
.browse-sizer { width: max-content; min-width: 100%; }
.browse-body { position: relative; }
.browse-row { display: grid; height: 22px; align-items: center; cursor: default; }
.browse-row > div { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-row > .right { text-align: right; }
.browse-body .browse-row { position: absolute; left: 0; right: 0; }
.browse-body .browse-row:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.browse-body .browse-row:hover { background: rgba(255, 255, 255, 0.08); }
.browse-body .browse-row[aria-selected="true"] { background: rgba(255, 210, 63, 0.28); }
.browse-body .browse-row.marked { outline: 1px dashed rgba(255, 255, 255, 0.5); outline-offset: -1px; }
.browse-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--dim);
}
.browse-empty, .working-empty {
  padding: 10px;
  white-space: pre-line;
  font-size: 12px;
  color: var(--dim);
}

/* Working: its rows, each with the ✕ that takes it out. */
.working { font-size: 12px; }
.working-row { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px; }
.working-row:hover { background: rgba(255, 255, 255, 0.08); }
.working-x { color: var(--dim); padding: 0 4px; }

/* The Graph: viz's SVG filling its Pane. */
#window .pane[data-id="graph"] .pane-body { overflow: hidden; }
.graph { width: 100%; height: 100%; }
.graph svg { display: block; }
.graph-words { padding: 10px; font-size: 12px; color: var(--dim); }

/* The Prebuilt Views: a name each, the chosen one lit. */
.prebuilt { display: flex; flex-direction: column; padding: 4px 0; font-size: 12px; }
.prebuilt-view { text-align: left; padding: 4px 10px; }
.prebuilt-view:hover { background: rgba(255, 255, 255, 0.08); }
.prebuilt-view.chosen { background: rgba(120, 180, 255, 0.25); }

/* The bullseye at the Map's center, the phone's: a dark ring, a light ring, a dot. */
#bullseye {
  position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px;
  border-radius: 50%; border: 4px solid rgba(20, 30, 40, 0.43); pointer-events: none; z-index: 2;
}
#bullseye::before {
  content: ""; position: absolute; inset: 1px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.67);
}
#bullseye::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #fff;
}

/* Forecast and Map Control (src/forecast.ts). */
#window .pane.expanded[data-id="forecast"] .pane-body { max-height: 50vh; }
:root { --selected: rgb(18, 58, 87); --sheet: rgb(13, 62, 94); --bottom: 0px; --warn: rgb(255, 200, 100); }
.forecast { padding: 4px 10px 0; font-size: 13px; }
.forecast-controls { display: flex; align-items: center; gap: 12px; }
.forecast-condition { font: inherit; color: inherit; background: var(--selected); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 4px; padding: 2px 6px; }
.forecast-sizes { display: flex; }
.forecast-sizes button { padding: 2px 12px; border: 1px solid rgba(255, 255, 255, 0.25); margin-left: -1px; }
.forecast-sizes button[aria-checked="true"] { background: rgba(120, 180, 255, 0.25); }
.forecast-reading { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 6px 0 2px; min-height: 46px; align-items: center; }
.forecast-reading[hidden], .forecast-tables[hidden], .forecast-foot[hidden] { display: none; }
.forecast-value { font-size: 20px; }
.forecast-arrow { display: inline-block; }
.forecast-under, .forecast-foot { color: var(--dim); }
.forecast-foot { padding: 2px 0; font-size: 12px; }
.ink-warn { color: var(--warn); }
.ink-dim { color: var(--dim); }
.forecast-tables { overflow-x: auto; padding-top: 4px; }
.forecast-tables.stale { opacity: 0.45; }
.forecast-table { border-collapse: separate; border-spacing: 0; }
.forecast-table th, .forecast-table td { font-weight: 400; text-align: center; padding: 1px 4px; white-space: nowrap; }
.forecast-table.hourly tr > :not(.forecast-label):not(.forecast-day) { min-width: 58px; cursor: pointer; }
.forecast-table.daily tr > :not(.forecast-label) { min-width: 92px; }
.forecast-table .forecast-label { position: sticky; left: 0; background: var(--panel); text-align: left; padding-right: 10px; z-index: 1; }
.forecast-table .forecast-day { text-align: left; }
.forecast-table .forecast-day span { position: sticky; left: 130px; }
.forecast-table .lit { background: rgba(120, 180, 255, 0.2); }
.forecast-table .small { color: var(--dim); font-size: 12px; }
/* The hour bar inside the Pane, not at the foot of the screen. */
.forecast-bar .tm { position: relative; inset: auto; z-index: 1; height: 40px; background: none; padding: 0; overflow: visible; }
.forecast-bar .tm[hidden], .forecast-bar .tm-days[hidden] { display: none; }
.forecast-bar .tm-daylist { left: 50%; top: 80px; bottom: auto; transform: translateX(-50%); }

/* Route Controls, Waypoints and the Voyage (src/routes.ts). */
.routes-controls { padding: 6px 8px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.routes-row { display: flex; gap: 5px; }
.routes-button { flex: 1 1 auto; padding: 3px 6px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; white-space: nowrap; }
.routes-button:disabled { opacity: 0.4; cursor: default; }
.routes-name { font: inherit; color: inherit; background: var(--selected); border: 1px solid rgba(255, 255, 255, 0.3); padding: 3px 6px; }
.routes-say { min-height: 1em; }
.routes-waypoints { font: 12px ui-monospace, Consolas, monospace; padding: 4px 0; }
.routes-waypoint { display: flex; align-items: center; gap: 8px; padding: 1px 8px; cursor: default; }
.routes-waypoint.picked { background: rgba(120, 180, 255, 0.2); }
.routes-n { width: 2ch; text-align: right; }
.routes-leg { width: 8ch; text-align: right; color: var(--dim); }
.routes-where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routes-rest { width: 7ch; font: inherit; color: inherit; background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); }
.routes-min { color: var(--dim); }
.routes-rest-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px 2px; font-family: system-ui, sans-serif; }
.routes-label { color: var(--dim); min-width: 3em; }
.routes-voyage { padding: 4px 8px; font-size: 13px; }
.routes-page { padding: 1px 0; }
.ink-good { color: rgb(52, 211, 153); }
.ink-bad { color: rgb(255, 110, 110); }
.working-row.route[aria-selected="true"] { background: rgba(120, 180, 255, 0.2); }
.routes-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.routes-button[aria-pressed="true"] { background: rgba(120, 180, 255, 0.25); }
.routes-text { flex: 1; min-width: 0; white-space: pre; overflow: hidden; text-overflow: ellipsis; }

/* Filters (src/filters.ts): a pill a filter, its dot, words and ×. */
.filters { padding: 6px 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; }
.filters-empty, .filters-working { color: var(--dim); white-space: pre-line; }
.filter-pill { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 9px; background: rgba(120, 180, 255, 0.3); }
.filter-pill.off { background: rgba(255, 255, 255, 0.08); color: var(--dim); }
.filter-room { height: 20px; width: 100%; border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 9px; }

/* The Voyage's document (src/voyage.ts), by the desktop's rules. */
.voyage { font-size: 13px; }
.voyage a { color: inherit; text-decoration: underline dotted; }
.voyage-row { padding: 1px 0; }
.voyage-break { margin-top: 8px; }
.voyage-indent { padding-left: 2em; }
.voyage-rule { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.15); margin: 6px 0; }
.voyage-cells, .voyage-grid { border-collapse: collapse; margin: 2px 0; }
.voyage-cells td { padding: 1px 12px 1px 0; vertical-align: top; }
.voyage-large { font-size: 18px; font-weight: 600; }
.voyage-grid th, .voyage-grid td { padding: 1px 8px 1px 0; text-align: left; font-weight: 400; white-space: nowrap; }
.voyage-picked { background: #ffd23f; color: #202020; padding: 0 3px; }
.voyage-lead { padding: 2px 0 4px; }
.working-row.route .working-text { white-space: pre; font: 12px ui-monospace, Consolas, monospace; }
.routes-asking { color: var(--dim); }
.filters.drop { outline: 1px dashed rgba(120, 180, 255, 0.8); outline-offset: -2px; }
.filter-text { cursor: pointer; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-text.dates { max-width: 150px; }
.filter-step { padding: 0 2px; font-size: 9px; color: var(--dim); }

/* Variables (src/variables.ts): the catalog's tables and their variables. */
.variables { display: flex; flex-direction: column; height: 100%; font-size: 12px; }
.variables-search { margin: 4px 8px; padding: 2px 6px; }
.variables-list { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 6px; }
.variables-source { font-size: 10px; color: var(--dim); margin-top: 6px; letter-spacing: 0.05em; }
.variables-table { font-weight: 700; cursor: pointer; padding: 2px 0; }
.variables-table::before { content: '▸ '; color: var(--dim); }
.variables-table.open::before { content: '▾ '; }
.variables-row { padding: 1px 0 1px 16px; cursor: grab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.variables-row:hover { background: rgba(255, 255, 255, 0.08); }

/* The asks a dropped variable makes (src/asks.ts). */
.ask { min-width: 360px; max-width: 560px; background: #1f2630; color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; padding: 12px; font-size: 12px; }
.ask::backdrop { background: rgba(0, 0, 0, 0.4); }
.ask-title { font-weight: 700; margin-bottom: 8px; }
.ask-body { display: flex; flex-direction: column; gap: 6px; }
.ask-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; }
.ask-spread { display: flex; align-items: flex-end; height: 48px; gap: 1px; }
.ask-spread > div { flex: 1; background: rgba(255, 255, 255, 0.18); min-height: 1px; }
.ask-spread > div.in { background: rgba(120, 180, 255, 0.7); }
.ask-rails { position: relative; height: 18px; }
.ask-rails input { position: absolute; inset: 0; width: 100%; pointer-events: none; background: none; }
.ask-rails input::-webkit-slider-thumb { pointer-events: auto; }
.ask-rails input::-moz-range-thumb { pointer-events: auto; }
.ask-said { text-align: center; color: var(--dim); }
.ask-boxes { display: flex; align-items: center; gap: 6px; }
.ask-boxes input { width: 6em; }
.ask-buttons { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }

/* Route Settings (src/routes.ts drawSettings): the desktop's form. */
.routes-settings { padding: 4px 8px; font-size: 12px; }
.settings-form { display: grid; grid-template-columns: max-content 1fr; gap: 4px 8px; align-items: center; }
.settings-label { color: var(--dim); }
.settings-value { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; position: relative; }
.settings-rows { display: grid; grid-template-columns: max-content 1fr auto auto; gap: 0 6px; align-items: center; }
.settings-target { background: none; border: none; color: var(--ink); cursor: pointer; padding: 1px 3px; text-decoration: underline dotted; }
.settings-target:disabled { color: var(--dim); cursor: default; text-decoration: none; }
.settings-number { width: 6ch; }
.settings-switch { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; }
.settings-pop { position: absolute; top: 100%; left: 0; z-index: 5; background: #1f2630; border: 1px solid rgba(255, 255, 255, 0.2); padding: 6px; border-radius: 4px; }
.settings-slider { width: 280px; }
.settings-clock { text-align: center; }
.ask-form { display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; align-items: center; }
.ask-form input[type=number] { width: 6em; margin-right: 4px; }
