:root {
    color-scheme: light;
    --accent: #ff00ff;
    --accent-dark: #b000b0;
    --selected: #0080ff;
    --hover: #80c0ff;
    --border: #d9d9de;
    --ink: #19191d;
    --muted: #6d6d76;
    --panel-width: 408px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@font-face {
    font-family: "Helvetica GTADB";
    src: url("https://gtadb.org/fonts/Helvetica.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Helvetica GTADB";
    src: url("https://gtadb.org/fonts/Helvetica-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}

* { box-sizing: border-box; }
html, body, #map { height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #d8d8d8; }
button, input { font: inherit; }
button { cursor: pointer; }

#map { position: fixed; inset: 0; }
#markers { z-index: 5; }
#routeOverlay {
    position: fixed;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
#routeOverlay[hidden] { display: none; }
#routeSegments path {
    fill: none;
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 6;
    pointer-events: stroke;
    cursor: pointer;
}
#routeSegments path:hover { stroke-width: 8; }
#routeSegments path.selected { stroke: var(--selected); stroke-width: 8; }
#routeDots circle {
    fill: var(--accent);
    stroke: white;
    stroke-width: 1;
}
#routeDots circle.endpoint { pointer-events: all; cursor: pointer; stroke-width: 2; }

#panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 10;
    inset: 16px auto 16px 16px;
    width: var(--panel-width);
    overflow: hidden;
    padding: 16px 0;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 18px;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
    backdrop-filter: blur(4px);
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
header {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 8px;
    flex: none;
    margin: 0 16px 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(25, 25, 29, .22);
}
.brand-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 10px;
    overflow: hidden;
}
.brand-icon img { display: block; width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.panel-content { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 4px 16px 1px; }
h1, h2, p { margin-top: 0; }
h1 {
    margin: 0;
    color: var(--ink);
    font-family: "Helvetica GTADB", Helvetica, sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-align: center;
}
h2 { margin-bottom: 8px; font-size: 18px; }
.eyebrow {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }

.search { position: relative; margin-bottom: 8px; }
.search-input-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.search-input-row:has(> button:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 8px;
}
input[type="search"] {
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: white;
}
input[type="search"]:focus { border-color: var(--selected); box-shadow: 0 0 0 3px #0080ff40; }
.search-results {
    position: absolute;
    z-index: 2;
    top: calc(100% + 8px);
    width: 100%;
    max-height: min(50vh, 360px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.search-result {
    display: block;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid #eeeeF2;
    text-align: left;
    background: transparent;
}
.search-result:hover, .search-result:focus { background: var(--hover); }
.search-result small { display: block; margin-top: 2px; color: var(--muted); }

.card, #directions { margin-top: 0; padding-top: 0; }
#directions:not([hidden]) { display: block; }
#directions .section-heading { height: 40px; }
#directions .section-heading h2 {
    margin: 0;
    padding-left: 4px;
    line-height: 1;
}
.primary, .quiet {
    min-height: 40px;
    padding: 0 13px;
    border-radius: 10px;
    font-weight: 650;
}
.primary { border: 1px solid var(--border); color: var(--ink); background: #eeeeF2; }
.quiet { border: 1px solid var(--border); color: var(--ink); background: #eeeeF2; }
.primary:not(:disabled):hover, .quiet:not(:disabled):hover, .waypoint-control:not(:disabled):hover { background: var(--hover); }
#dimensionButton { color: var(--ink); background: #eeeeF2; }

#selectionCard h2 { margin-bottom: 8px; padding-inline: 4px; line-height: 1.3; }
#selectionCard h2:has(+ .selection-address:not([hidden])) { margin-bottom: 1px; }
.selection-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 8px;
    border-radius: 9px;
    background: #d0d0d5;
    object-fit: cover;
}
.selection-image.empty { color: transparent; }
.selection-image[hidden] { display: none; }
.selection-address { margin: 0 0 8px; padding-inline: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.direction-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.direction-actions button { min-height: 40px; padding-inline: 13px; font-size: inherit; }
.direction-actions button:disabled { cursor: default; opacity: .45; }
.waypoint-fields { display: grid; gap: 8px; margin-top: 8px; }
.waypoint-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: center; }
.waypoint-field:has(> .waypoint-control:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 8px;
}
.waypoint-field:has(> .waypoint-control:not([hidden]) ~ .waypoint-control:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 40px 40px;
}
.waypoint-input { position: relative; min-width: 0; }
.waypoint-field input[type="search"] { padding-left: 14px; }
.waypoint-field input[type="search"]::-webkit-search-cancel-button { display: none; }
.waypoint-field .search-results { top: calc(100% + 4px); }
.waypoint-control {
    width: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--ink);
    background: #eeeeF2;
    font-size: 20px;
    font-weight: 700;
}
.symbol-button { min-width: 40px; padding: 0 10px; font-size: 20px !important; font-weight: 700; }
.icon-button { min-width: 40px; min-height: 40px; padding: 0; font-size: 20px; font-weight: 700; }
.raised-symbol { padding-bottom: 3px; line-height: 1; }
#preferencesButton { padding-bottom: 5px; }
#preferencesButton.settings-open { padding-bottom: 3px; }
.waypoint-control { padding-bottom: 3px; line-height: 1; }
.route-images {
    display: grid;
    grid-template-columns: repeat(var(--photos), minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
    margin-top: 8px;
    border-radius: 9px;
    overflow: hidden;
}
.route-images[hidden] { display: none; }
.route-image-slot {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 7px;
    background: #d0d0d5;
}
.route-image-slot img { display: block; width: 100%; height: 100%; object-fit: cover; }

.itinerary-scroll { margin-top: 8px; }
.itinerary { display: grid; gap: 8px; margin-top: 0; }
.itinerary-line { font-size: 13px; line-height: 1.4; }
.itinerary-endpoint {
    width: 100%;
    padding: 3px 4px;
    border: 0;
    border-radius: 6px;
    color: inherit;
    font-weight: 700;
    text-align: left;
    background: transparent;
}
.itinerary-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    padding: 3px 4px;
    border: 0;
    border-radius: 6px;
    color: inherit;
    text-align: left;
    background: transparent;
}
.itinerary-step:hover, .itinerary-step:focus, .itinerary-endpoint:hover, .itinerary-endpoint:focus { background: var(--hover); }
.itinerary-step.selected, .itinerary-endpoint.selected { color: white; background: var(--selected); }
#routeStatus { margin: 8px 0 0; padding-inline: 4px; color: var(--ink); font-size: 13px; line-height: 1.4; }
footer {
    flex: none;
    height: 46px;
    margin: 16px 16px 0;
    padding-top: 16px;
    border-top: 1px solid rgba(25, 25, 29, .22);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
    text-transform: uppercase;
}
#preferences { margin-top: 12px; padding-top: 0; border-top: 0; }
#preferences h2, #preferences label { padding-inline: 4px; }
#preferences label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(0, 0, 0, .04);
}
.segmented button {
    min-height: 40px;
    border: 0;
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-weight: 650;
    cursor: pointer !important;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button:hover { background: var(--hover); }
.segmented button.selected { color: white; background: var(--selected); }
#hoverInfo span { display: block; }
#locationLine { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 400; text-transform: none; }

#notice {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    padding: 10px 14px;
    border-radius: 999px;
    color: white;
    background: rgba(0, 0, 0, .5);
    font-size: 13px;
    transition: opacity .2s;
}
#notice[hidden] { display: none; }
.panel-handle { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.marker, .marker.selected {
    width: 18px;
    height: 18px;
    margin-left: -11px;
    margin-top: -11px;
    border: 2px solid white;
    border-radius: 50%;
    border-width: 2px;
    background-color: var(--accent) !important;
    transform: none;
}

@media (max-width: 700px) {
    #panel {
        display: block;
        inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px;
        width: auto;
        max-height: min(58vh, 520px);
        overflow: auto;
        padding: 10px 16px 16px;
        border-radius: 20px;
    }
    header { margin: 0 0 8px; padding-bottom: 0; border-bottom: 0; }
    .panel-content { overflow: visible; padding: 0; }
    footer { margin-inline: 0; }
    .panel-handle {
        display: block;
        width: 38px;
        height: 4px;
        margin: 0 auto 8px;
        border-radius: 2px;
        background: #c6c6cc;
    }
    h1 { font-size: 15px; }
    header .eyebrow { display: none; }
    button, input[type="search"] { min-height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
