/* Same palette as the app: yellow is a fill, amber (--brand-ink) is for text. */
:root {
  --brand: #ffc800;
  --on-brand: #141414;
  --background: #f5f5f1;
  --surface: #fafaf7;
  --card: #fff;
  --border: #00000014;
  --input: #f0f0eb;
  --brand-ink: #9a6b00;
  --brand-tint: #ffc80040;
  --text: #16171a;
  --secondary: #606369;
  --hint: #94979d;
  --error: #d92d20;
  --accent: #2563eb;
  --success: #15803d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0e0f11;
    --surface: #17181b;
    --card: #1e2024;
    --border: #ffffff1f;
    --input: #1a1c1f;
    --brand-ink: #ffc800;
    --brand-tint: #ffc80024;
    --text: #f5f6f7;
    --secondary: #a9acb2;
    --hint: #70747b;
    --error: #ff5a52;
    --accent: #5b9dff;
    --success: #32d74b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-columns: 400px 1fr;
  background: var(--background);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#panel {
  overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-right: 1px solid var(--border);
}
h1 { margin: 0 0 16px; font-size: 20px; }

#map-area { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; }

.stops {
  position: relative;
  padding-right: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.stop { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 16px; }
.stop + .stop { border-top: 1px solid var(--border); }
.stop input { flex: 1; min-width: 0; height: 44px; padding: 0 6px; border: 0; background: none; outline-offset: -4px; }
.stop input::placeholder { color: var(--hint); }
.dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.dot.origin { border: 4px solid var(--success); }
.dot.destination { background: var(--error); }
.pick {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 600;
}
#swap {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 36px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  background: none;
  color: var(--secondary);
  font-size: 20px;
}
.suggestions {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: -1px;
  right: -49px;
  max-height: 320px;
  overflow-y: auto;
  margin: 4px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px #0004;
}
.suggestions li { padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.suggestions li[aria-selected="true"], .suggestions li:not(.note):hover { background: var(--brand-tint); }
.suggestions li.note { color: var(--secondary); cursor: default; }
.suggestions small { display: block; color: var(--secondary); font-size: 13px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.options label { font-size: 13px; color: var(--secondary); min-width: 0; }
.options .wide { grid-column: 1 / -1; }
.options select, .options input {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 4px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input);
  color: var(--text);
  font-size: 15px;
}
.hint { font-size: 12px; color: var(--secondary); }

#calculate {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 17px;
  font-weight: 600;
}
#calculate:disabled { background: var(--input); color: var(--hint); cursor: default; }

#message { margin: 16px 0 0; color: var(--error); }
#results { margin-top: 20px; display: grid; gap: 10px; }
#results > .foot { margin: 4px 0 0; font-size: 12px; color: var(--secondary); }
.notice { margin: 0; padding: 12px; border-radius: 12px; background: var(--brand-tint); font-size: 13px; }

.route { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.route.selected { border-color: var(--brand-ink); box-shadow: 0 0 0 1px var(--brand-ink); }
.route > button { display: block; width: 100%; padding: 14px; border: 0; background: none; text-align: left; outline-offset: -4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { padding: 3px 9px; border-radius: 8px; background: var(--brand-tint); color: var(--brand-ink); font-size: 12px; font-weight: 700; }
.tag.strong { background: var(--brand); color: var(--on-brand); }
.tag.warning { background: color-mix(in srgb, var(--error) 16%, transparent); color: var(--error); }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row > :last-child { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.name { font-size: 16px; font-weight: 600; }
.total { font-size: 22px; font-weight: 700; line-height: 1.15; }
.small { font-size: 12px; color: var(--secondary); }
.unofficial { color: var(--brand-ink); }
.details { padding: 0 14px 14px; }
.details > * + * { margin-top: 10px; }
.details hr { margin: 0; border: 0; border-top: 1px solid var(--border); }
.details hr:not(:first-child) { margin-top: 12px; }
.missing { color: var(--error); }

.pin { width: 20px; height: 20px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 1px 6px #0008; }
.pin.origin { background: #15803d; }
.pin.destination { background: #d92d20; }
.price { padding: 4px 10px; border-radius: 99px; background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: 13px; box-shadow: 0 1px 6px #0006; }
.price.missing { background: #d92d20; color: #fff; }

#picking {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 10px 10px 16px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 4px 20px #0005;
}
#picking button { padding: 8px 12px; border: 0; border-radius: 10px; background: var(--input); color: var(--brand-ink); font-weight: 600; }
.is-picking .maplibregl-canvas-container { cursor: crosshair; }

@media (max-width: 760px) {
  body { grid-template-columns: 1fr; grid-template-rows: 40dvh auto; height: auto; }
  #map-area { grid-row: 1; position: sticky; top: 0; height: 40dvh; z-index: 1; }
  #panel { grid-row: 2; min-height: 60dvh; overflow: visible; border-right: 0; border-top: 1px solid var(--border); }
}
