@font-face { font-family: B612; src: url(assets/fonts/b612-latin-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: B612; src: url(assets/fonts/b612-latin-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --djup: #07141B; --grunn: #123240; --hraun: #141E23; --is: #EAF3F5; --thoka: #A9BBC2; --grjot: #8499A2;
  --panel: rgba(20, 30, 35, .955); --line: rgba(234, 243, 245, .12); --line2: rgba(234, 243, 245, .24); --hover: rgba(234, 243, 245, .07);
  --green: #3fca7a; --amber: #F2B13A; --red: #E85A5A;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --r: 10px; --w: 388px;
  font: 14px/1.4 B612, system-ui, -apple-system, sans-serif; color: var(--is); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--djup); overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--is); outline-offset: 2px; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; transform-origin: 0 0; will-change: transform; font-size: 12px; color: var(--is);
  text-shadow: 0 0 3px #07141B, 0 0 6px #07141B, 0 1px 2px #000; pointer-events: none; }
.lbl.town { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.lbl.town.city { font-size: 18px; }
.lbl.stop { font-size: 11.5px; color: var(--thoka); }
.lbl.stop.hl { color: var(--is); font-weight: 700; font-size: 12.5px; }
.lbl.bus { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; text-shadow: none; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.lbl.street { font-size: 11px; color: rgba(234,243,245,.62); font-style: italic; }

.panel { position: fixed; z-index: 5; left: calc(12px + var(--sal)); top: calc(12px + var(--sat)); bottom: calc(12px + var(--sab)); width: var(--w);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45); overflow: hidden; }
.grip { display: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; }
.logo svg { width: 30px; height: 30px; fill: var(--is); stroke: none; } .logo .w { fill: var(--djup); }
.title { display: flex; flex-direction: column; line-height: 1.15; flex: 1; } .title b { font-size: 17px; } .title span { color: var(--grjot); font-size: 12.5px; }
.chip { border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--thoka); }
.chip:hover { color: var(--is); border-color: var(--is); }
.tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 10px 8px; color: var(--grjot); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--thoka); } .tabs button.on { color: var(--is); border-color: var(--is); }
.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 8px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.attr { padding: 6px 14px 9px; font-size: 10.5px; color: var(--grjot); border-top: 1px solid var(--line); }

/* origin / destination */
.od { position: relative; display: grid; grid-template-columns: 18px 1fr 34px; gap: 6px; align-items: center; }
.dots { display: flex; flex-direction: column; align-items: center; height: 70px; justify-content: space-between; padding: 14px 0; }
.dots i { display: block; } .dots .o { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--is); }
.dots .l { flex: 1; width: 2px; margin: 3px 0; background: repeating-linear-gradient(var(--grjot) 0 3px, transparent 3px 6px); }
.dots .d { width: 11px; height: 11px; background: var(--is); clip-path: polygon(50% 100%, 0 0, 100% 0); border-radius: 2px; }
.fields { display: flex; flex-direction: column; gap: 6px; }
.field { position: relative; }
.field input { width: 100%; height: 38px; padding: 0 36px 0 11px; background: var(--djup); border: 1px solid var(--line2); border-radius: 8px; outline: none; }
.field input:focus { border-color: var(--is); }
.field input::placeholder { color: var(--grjot); }
.field .ico { position: absolute; right: 3px; top: 3px; width: 32px; height: 32px; }
.ico { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--thoka); }
.ico:hover { background: var(--hover); color: var(--is); }
.swap svg { width: 18px; height: 18px; }
.suggest { position: absolute; z-index: 10; left: 24px; right: 0; top: 100%; margin-top: 4px; background: #182429; border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5); max-height: 340px; overflow-y: auto; padding: 4px; }
.sg { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 7px 8px; border-radius: 7px; }
.sg:hover, .sg.on { background: var(--grunn); }
.sg .k { color: var(--grjot); display: grid; place-items: center; } .sg .k svg { width: 17px; height: 17px; }
.sg .n { overflow: hidden; } .sg .n b { font-weight: 400; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg .n small { color: var(--grjot); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg .star { color: var(--grjot); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; }
.sg .star:hover { color: var(--amber); } .sg .star.on { color: var(--amber); } .sg .star.on svg { fill: currentColor; }
.sg-h { font-size: 11px; color: var(--grjot); padding: 8px 8px 3px; text-transform: none; }
.rb { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.badge { display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 5px; border-radius: 5px; font-size: 12px; font-weight: 700; line-height: 1; }
.badge.sm { min-width: 20px; height: 17px; font-size: 10.5px; padding: 0 4px; border-radius: 4px; }

.when { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { padding: 5px 10px; border-radius: 6px; color: var(--thoka); font-size: 13px; }
.seg button:hover { color: var(--is); } .seg button.on { background: var(--is); color: var(--djup); }
.seg.small button { padding: 3px 8px; font-size: 12px; }
#when { height: 34px; background: var(--djup); border: 1px solid var(--line2); border-radius: 8px; padding: 0 8px; color-scheme: dark; flex: 1; min-width: 180px; }
.walk { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.walk label { color: var(--thoka); font-size: 13px; } .walk label b { color: var(--is); font-weight: 700; }
.walk input[type=range] { grid-column: 1; width: 100%; accent-color: var(--is); }
.walk .seg { grid-column: 2; grid-row: 1 / span 2; }

.results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--grjot); padding: 18px 6px; text-align: center; line-height: 1.5; }
.empty b { color: var(--thoka); }
.it { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 11px; text-align: left; width: 100%; display: block; background: rgba(7,20,27,.35); }
.it:hover { border-color: var(--line2); } .it.on { border-color: var(--is); background: rgba(18,50,64,.55); }
.it .top { display: flex; align-items: baseline; gap: 8px; }
.it .times { font-size: 16px; font-weight: 700; } .it .dur { margin-left: auto; color: var(--thoka); }
.it .chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 7px 0 5px; color: var(--grjot); }
.it .chain svg { width: 15px; height: 15px; } .it .chain .sep { opacity: .5; font-size: 11px; }
.it .chain .wk { display: inline-flex; align-items: center; gap: 1px; font-size: 11.5px; }
.it .meta { color: var(--grjot); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.live { color: var(--green); } .live.late { color: var(--amber); } .live.vlate { color: var(--red); }
.live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.legs { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.leg { display: grid; grid-template-columns: 46px 18px 1fr; gap: 0 8px; }
.leg .t { color: var(--thoka); font-size: 13px; text-align: right; padding-top: 1px; font-variant-numeric: tabular-nums; }
.leg .rail { position: relative; display: flex; justify-content: center; }
.leg .rail::before { content: ''; position: absolute; top: 14px; bottom: -2px; width: 4px; border-radius: 2px; background: var(--c, var(--grjot)); }
.leg.walk .rail::before { width: 0; border-left: 3px dotted var(--grjot); background: none; }
.leg .rail i { position: relative; z-index: 1; width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; background: var(--hraun); border: 2.5px solid var(--c, var(--is)); }
.leg .body { padding-bottom: 12px; min-width: 0; } .leg .body b { font-weight: 700; }
.leg .body .sub { color: var(--grjot); font-size: 12.5px; margin-top: 2px; }
.leg .body .ride { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.leg .body details { margin-top: 4px; color: var(--grjot); font-size: 12.5px; }
.leg .body details summary { cursor: pointer; list-style: none; } .leg .body details summary::before { content: '▸ '; } .leg .body details[open] summary::before { content: '▾ '; }
.leg .body details ol { margin: 4px 0 0; padding-left: 0; list-style: none; } .leg .body details li { display: flex; gap: 8px; padding: 1px 0; } .leg .body details li span { min-width: 38px; text-align: right; }
.leg.end .rail::before { display: none; }
.btnrow { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line2); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; color: var(--thoka); display: inline-flex; gap: 6px; align-items: center; }
.btn:hover { color: var(--is); border-color: var(--is); } .btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--is); color: var(--djup); border-color: var(--is); }
.more { margin: 4px auto 0; display: block; }

/* stop boards, lines, towns */
.h2 { font-size: 16px; font-weight: 700; margin: 2px 0 2px; display: flex; gap: 8px; align-items: center; }
.muted { color: var(--grjot); font-size: 12.5px; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 8px; width: 100%; text-align: left; }
.row:hover { background: var(--hover); }
.row .r1 { min-width: 0; } .row .r1 b { font-weight: 400; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r1 small { color: var(--grjot); font-size: 12px; }
.row .eta { text-align: right; font-variant-numeric: tabular-nums; } .row .eta b { font-size: 15px; display: block; } .row .eta small { color: var(--grjot); font-size: 11.5px; }
.sect { margin: 14px 0 6px; font-size: 12px; color: var(--grjot); }
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid .badge { min-width: 38px; height: 30px; font-size: 14px; border-radius: 7px; cursor: pointer; }
.grid .badge:hover { outline: 2px solid var(--is); outline-offset: 1px; }
.back { color: var(--thoka); display: inline-flex; gap: 4px; align-items: center; font-size: 13px; margin-bottom: 6px; } .back:hover { color: var(--is); }
.stoplist { list-style: none; margin: 6px 0 0; padding: 0; }
.stoplist li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }
.stoplist li:hover { color: var(--is); }
.stoplist li i { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid var(--c); background: var(--hraun); justify-self: center; }

/* map controls */
.mapctl { position: fixed; z-index: 4; right: calc(12px + var(--sar)); top: calc(12px + var(--sat)); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mapctl > .ico { background: var(--panel); border: 1px solid var(--line); width: 40px; height: 40px; font-size: 12.5px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.mapctl .fill { fill: var(--red); stroke: var(--red); }
.layers { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.layers label { display: flex; gap: 8px; align-items: center; cursor: pointer; } .layers input { accent-color: var(--is); }
.pop { position: fixed; z-index: 6; min-width: 220px; max-width: 290px; background: #182429; border: 1px solid var(--line2); border-radius: 12px; padding: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.55); transform: translate(-50%, calc(-100% - 14px)); }
.pop::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; background: #182429; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); transform: translateX(-50%) rotate(45deg); }
.pop .pt { font-weight: 700; } .pop .ps { color: var(--grjot); font-size: 12px; }
.pop .btnrow { margin-top: 8px; } .pop .row { padding: 4px 4px; }
.toast { position: fixed; z-index: 9; left: 50%; top: calc(16px + var(--sat)); transform: translateX(-50%); background: var(--is); color: var(--djup); padding: 8px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.boot { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--djup); color: var(--thoka); transition: opacity .5s; }
.boot.gone { opacity: 0; pointer-events: none; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--is); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { height: 64px; border-radius: var(--r); background: linear-gradient(90deg, rgba(234,243,245,.04), rgba(234,243,245,.09), rgba(234,243,245,.04)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* phones: the panel is a bottom sheet with three heights */
@media (max-width: 760px) {
  :root { --r: 12px; }
  .panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 46dvh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: var(--sab); transition: height .25s ease; }
  .panel.min { height: calc(148px + var(--sab)); } .panel.max { height: calc(100dvh - 56px - var(--sat)); }
  .grip { display: block; width: 100%; height: 18px; flex: none; position: relative; cursor: grab; }
  .grip::after { content: ''; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); transform: translateX(-50%); }
  .brand { padding: 0 14px 6px; } .brand .logo svg { width: 24px; height: 24px; } .title b { font-size: 15px; }
  .field input { height: 42px; font-size: 16px; }
  .attr { display: none; }
  .mapctl { top: calc(10px + var(--sat)); right: calc(10px + var(--sar)); }
  .mapctl > .ico { width: 44px; height: 44px; }
  .seg button { padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
