:root {
    --bus: #1f6fd1;
    --busd: #154a99;
    --ink: #14202b;
    --mute: #667789;
    --line: #dfe5eb;
    --bg: #f1f4f7;
    --paper: #fff;
    --amber: #ffb300
}

@media (prefers-color-scheme:dark) {
    :root {
        --bus: #4a93f0;
        --busd: #8dbcff;
        --ink: #e8eef3;
        --mute: #9bacba;
        --line: #2b3947;
        --bg: #0f1a24;
        --paper: #17242f
    }
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%;
    margin: 0
}

body {
    position: relative;
    overflow: hidden;
    font: 16px/1.4 "Atkinson Hyperlegible", system-ui, sans-serif;
    color: var(--ink)
}

button,
input,
select {
    font: inherit;
    color: inherit
}

button {
    cursor: pointer
}

a {
    color: inherit;
    text-decoration: none
}

:focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 2px
}

#map {
    position: absolute;
    inset: 0
}

#top {
    position: absolute;
    z-index: 1000;
    top: 12px;
    left: 12px;
    right: 64px;
    max-width: 440px
}

#bar {
    display: flex;
    background: var(--paper);
    border-radius: 999px;
    box-shadow: 0 2px 12px #0003;
    padding: 4px
}

#q {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    padding: 8px 14px;
    outline: none;
    font-size: 1rem
}

#cfg {
    border: 0;
    background: var(--bg);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem
}

#results {
    margin-top: 8px;
    max-height: 60vh;
    overflow: auto;
    background: var(--paper);
    border-radius: 16px;
    box-shadow: 0 4px 20px #0004;
    padding: 6px
}

#chip {
    margin-top: 8px;
    border: 0;
    border-radius: 999px;
    background: var(--amber);
    color: #14202b;
    padding: 5px 14px;
    font-weight: 700;
    box-shadow: 0 2px 8px #0003
}

h3 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mute);
    margin: 10px 8px 2px
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 9px 8px;
    border-radius: 10px
}

.row:hover {
    background: var(--bg)
}

.row small {
    display: block;
    color: var(--mute);
    font-size: .85rem
}

.row .eta {
    margin-left: auto;
    font-weight: 700;
    white-space: nowrap
}

.badge {
    display: inline-block;
    min-width: 44px;
    text-align: center;
    padding: 1px 9px;
    border-radius: 999px;
    background: var(--bus);
    color: #fff;
    font-weight: 700;
    flex: none
}

.pin {
    width: 24px;
    text-align: center;
    color: var(--bus);
    flex: none
}

/* panel dolny */
#sheet {
    position: absolute;
    z-index: 1000;
    left: 12px;
    bottom: 12px;
    width: min(560px, calc(100% - 24px));
    max-height: 46vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border-radius: 18px;
    box-shadow: 0 -2px 24px #0004;
    overflow: hidden;
    transition: max-height .2s
}

#sheet.tall {
    max-height: 86vh
}

#sheet.low {
    max-height: 104px
}

#grip {
    border: 0;
    background: none;
    height: 18px;
    flex: none
}

#grip::after {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: var(--line);
    margin: auto
}

#shead {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 2px 12px 10px;
    border-bottom: 1px solid var(--line)
}

#shead .ht {
    flex: 1;
    min-width: 0
}

#shead h2 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap
}

#shead p {
    margin: 2px 0 0;
    color: var(--mute);
    font-size: .9rem
}

.ic {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--bg);
    display: grid;
    place-items: center;
    flex: none;
    font-size: 1.1rem
}

#sbody {
    overflow: auto;
    padding: 8px 12px 20px
}

.dir {
    display: flex;
    gap: 6px;
    margin: 4px 0 10px
}

.dir a {
    flex: 1;
    text-align: center;
    padding: 7px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .92rem
}

.dir a[aria-current=true] {
    background: var(--bus);
    border-color: var(--bus);
    color: #fff
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.chip {
    border: 1px solid var(--line);
    background: var(--bg);
    border-radius: 999px;
    padding: 3px 11px;
    font-variant-numeric: tabular-nums
}

.chip.next,
.row.next {
    box-shadow: inset 3px 0 0 var(--amber)
}

.hint {
    color: var(--mute);
    font-size: .88rem;
    margin: 10px 0 0
}

.tl .st {
    display: grid;
    grid-template-columns: 48px 22px 1fr;
    align-items: center;
    min-height: 40px;
    font-variant-numeric: tabular-nums
}

.tl .st:hover {
    background: var(--bg)
}

.tl .d {
    position: relative;
    align-self: stretch
}

.tl .d::before {
    content: "";
    position: absolute;
    left: 9px;
    width: 4px;
    top: 0;
    bottom: 0;
    background: var(--bus)
}

.tl .st:first-child .d::before {
    top: 50%
}

.tl .st:last-child .d::before {
    bottom: 50%
}

.tl .d::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border-radius: 50%;
    background: var(--paper);
    border: 3px solid var(--bus)
}

.tl .past b,
.tl .past span {
    color: var(--mute)
}

.tl .past .d::before {
    background: #b8c3ce
}

.tl .past .d::after {
    border-color: #b8c3ce
}

.tl .next .d::after {
    background: var(--amber);
    border-color: var(--amber)
}

.tl .next span {
    font-weight: 700
}

.err {
    color: #b3261e;
    background: #fdecea;
    padding: 10px;
    border-radius: 8px;
    margin: 12px
}

/* ustawienia */
#settings {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #0006;
    display: grid;
    place-items: center;
    padding: 12px
}

#settings[hidden] {
    display: none
}

#settings .card {
    width: min(420px, 100%);
    background: var(--paper);
    border-radius: 18px;
    padding: 6px 16px 16px
}

#settings header {
    display: flex;
    justify-content: space-between;
    align-items: center
}

#settings h2 {
    font-size: 1.15rem
}

#cfgclose {
    border: 0;
    background: var(--bg);
    width: 36px;
    height: 36px;
    border-radius: 50%
}

.set {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line)
}

.set.col {
    flex-direction: column;
    align-items: stretch
}

.set input[type=checkbox] {
    width: 22px;
    height: 22px;
    accent-color: var(--bus)
}

.set select,
.when input {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px 10px
}

.when {
    display: flex;
    gap: 6px
}

.when input {
    flex: 1;
    min-width: 0
}

#now {
    background: var(--bus);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 0 14px
}

.note {
    color: var(--mute);
    font-size: .88rem;
    margin: 12px 0 0
}

/* pojazdy */
.veh {
    position: absolute !important
}

.vi {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%)
}

.vi b {
    position: relative;
    display: block;
    min-width: 36px;
    padding: 0 8px;
    text-align: center;
    color: #fff;
    background: #1f6fd1;
    font: 700 12px/20px "Atkinson Hyperlegible", sans-serif;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 1px 5px #0006;
    white-space: nowrap
}

.vi .ar {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px
}

.vi .ar i {
    position: absolute;
    left: 50%;
    top: 0;
    margin-left: -6px;
    border: 6px solid transparent;
    border-bottom: 11px solid #1f6fd1;
    border-top: 0;
    filter: drop-shadow(0 0 1px #fff)
}

.vi.wait b {
    opacity: .6;
    border-style: dashed
}

.vi.sel b {
    background: #14202b;
    box-shadow: 0 0 0 3px var(--amber), 0 1px 5px #0006
}

.vi.sel .ar i {
    border-bottom-color: #14202b
}

@media (prefers-reduced-motion:reduce) {
    #sheet {
        transition: none
    }
}

.varh {
    display: block;
    margin: 14px 0 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--bg);
    font-weight: 700;
    border-left: 4px solid transparent
}

.varh small {
    font-weight: 400;
    color: var(--mute);
    margin-left: 6px
}

.varh[aria-current=true] {
    border-left-color: var(--bus)
}

#sheet[hidden] {
    display: none !important;
}

#sheet {
    min-height: 110px;
    box-sizing: border-box;
}

#shead {
    min-height: 64px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

#grip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    min-height: 48px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
    pointer-events: auto;
    position: relative;
    z-index: 20;
}

#sheet {
    box-sizing: border-box;
    min-height: 110px;
}

#sheet.dragging {
    transition: none !important;
    user-select: none;
}

#sbody {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}


@media (max-width: 720px) {
    #sheet {
        position: fixed !important;
        top: 52vh !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;

        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;

        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-radius: 18px 18px 0 0;
        transition: none !important;
    }

    #sheet.low,
    #sheet.tall {
        top: 52vh !important;
        bottom: 0 !important;
        height: auto !important;
        max-height: none !important;
    }

    #shead {
        flex-shrink: 0;
    }

    #sbody {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}