body {
    margin: 0;
    font-family: Arial, sans-serif;
    line-height: 1.5;
    background: #f4f1ea;
    color: #1f1f1f;
}

a {
    color: #0b63ce;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header > div:last-child {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0 0 8px;
}

.page-intro,
.page-meta {
    margin: 0;
    color: #5c574f;
}

.button {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    background: #1f1f1f;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    text-decoration: none;
    background: #373737;
}

.button-secondary {
    background: #746b5d;
}

.button-secondary:hover {
    background: #62594d;
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    background: #ebe4d8;
    margin-top: 20px;
}

.alert-error {
    background: #f7d9d9;
    color: #7d1d1d;
}

.table-wrapper {
    margin-top: 20px;
    overflow-x: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #ece7dd;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8f5ef;
    font-size: 14px;
}

td {
    font-size: 14px;
}

.log-panel {
    margin-top: 20px;
    padding: 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.log-line {
    padding: 8px 10px;
    border-bottom: 1px solid #f0ece4;
    font-family: Consolas, monospace;
    font-size: 14px;
}

.log-line:last-child {
    border-bottom: 0;
}

.log-line--success {
    color: #176336;
}

.log-line--error {
    color: #9b1f1f;
}

.log-line--skip {
    color: #7d5d12;
}

@media (max-width: 720px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        text-align: center;
    }
}

.map-page {
    background: #d8ddd4;
}

.map-shell {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: linear-gradient(180deg, #d4dad3 0%, #bfc9be 100%);
}

.map-canvas {
    position: absolute;
    inset: 0;
}

.route-card {
    position: absolute;
    top: 92px;
    left: 16px;
    z-index: 3;
    width: min(420px, calc(100vw - 32px));
    padding: 16px;
    border-radius: 16px;
    background: rgba(244, 241, 234, 0.95);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(10px);
}

.route-card[hidden] {
    display: none;
}

.route-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.route-card__title {
    margin: 0;
    font-size: 24px;
}

.route-form {
    display: grid;
    gap: 14px;
}

.route-form__fields,
.route-form__controls {
    display: grid;
    gap: 12px;
}

.route-form__field,
.route-form__range {
    display: grid;
    gap: 6px;
}

.route-form__autocomplete {
    position: relative;
}

.route-form__field span,
.route-form__range span {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
}

.route-form__field input {
    width: calc(100% - 2em);
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(92, 87, 79, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
}

.route-form__field input:focus {
    outline: 2px solid rgba(29, 78, 216, 0.2);
    border-color: #1d4ed8;
}

.route-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
    display: grid;
    gap: 4px;
    max-height: 220px;
    overflow: auto;
    padding: 6px;
    border: 1px solid rgba(92, 87, 79, 0.16);
    border-radius: 12px;
    background: rgba(255, 250, 246, 0.98);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.button[hidden],
.route-suggestions[hidden] {
    display: none !important
}

.route-suggestion {
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.route-suggestion:hover,
.route-suggestion--active {
    background: rgba(29, 78, 216, 0.1);
}

.route-form__range input {
    width: 100%;
}

.route-form__range strong {
    font-size: 14px;
    color: #1f2937;
}

.route-form__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.route-status {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.45;
    color: #374151;
}

.route-status--error {
    color: #b91c1c;
}

.map-status-card {
    position: absolute;
    top: 92px;
    left: 16px;
    z-index: 3;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(244, 241, 234, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    font-size: 14px;
    display: none;
}

.map-actions {
    position: absolute;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 3;
    display: flex;
    gap: 12px;
    transform: translateX(-50%);
}

.map-actions[hidden] {
    display: none;
}

.map-status-card p {
    margin: 0;
}

.map-debug-log {
    margin-top: 10px;
    max-height: 180px;
    overflow: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 12px;
    line-height: 1.35;
}

.map-debug-log p {
    margin: 0 0 4px;
}

.map-fallback {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.map-fallback[hidden] {
    display: none;
}

.map-fallback__box {
    max-width: 520px;
    padding: 24px;
    border-radius: 14px;
    background: rgba(255, 250, 246, 0.94);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}

.map-fallback__box h2 {
    margin-top: 0;
    margin-bottom: 12px;
}

.map-fallback__box p {
    margin: 0 0 8px;
}

.map-toolbar {
    margin-top: 24px;
}

.itinerary-panel {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: min(380px, 92vw);
    height: 100%;
    background: rgba(244, 241, 234, 0.97);
    box-shadow: 12px 0 28px rgba(0, 0, 0, 0.18);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    backdrop-filter: blur(8px);
}

.itinerary-panel--open {
    transform: translateX(0);
}

.itinerary-panel__inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    padding: 24px 24px;
    overflow: auto;
}

.itinerary-sheet-handle {
    display: none;
}

.itinerary-sheet-handle__bar {
    display: block;
    width: 52px;
    height: 6px;
    margin: 0 auto;
    border-radius: 999px;
    background: rgba(92, 87, 79, 0.34);
}

.itinerary-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.itinerary-panel__header h2 {
    margin: 0;
    font-size: 24px;
}

.itinerary-panel__summary,
.itinerary-panel__empty,
.itinerary-stop__label,
.itinerary-location__distance,
.itinerary-pinball__meta,
.itinerary-location__empty {
    margin: 0;
    color: #5c574f;
    font-size: 0.8em;
}

.itinerary-panel__content,
.itinerary-locations,
.itinerary-location__pinballs {
    display: grid;
    gap: 16px;
}

.around-panel__form {
    gap: 14px;
}

.around-panel .itinerary-panel__content {
    display: grid;
    gap: 10px;
}

.map-marker-around {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.28));
    transform: translateY(10px);
    user-select: none;
    pointer-events: none;
}

.around-location__open {
    flex: 0 0 auto;
}

.itinerary-panel__actions {
    position: sticky;
    margin-top: 4px;
    bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 0 20px 6px white;
}

.itinerary-panel__actions .button {
    width: 100%;
}

.pinball-finder-panel .itinerary-panel__content {
    gap: 12px;
}

.itinerary-stop,
.itinerary-location {
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(92, 87, 79, 0.12);
}

.itinerary-location--selected {
    background: rgba(220, 252, 231, 0.92);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.24);
    outline: solid 3px #60ab05;
}

.itinerary-location--highlighted {
    box-shadow:
        inset 0 0 0 2px rgba(29, 78, 216, 0.42),
        0 10px 24px rgba(29, 78, 216, 0.12);
}

.itinerary-stop__title,
.itinerary-location__name {
    margin: 6px 0 0;
    font-size: 19px;
    line-height: 1.3;
    color: #1f1f1f;
}

.freshness-label {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.freshness-label--itinerary {
    margin-bottom: 4px;
    font-size: 0.6em;
    letter-spacing: 0;
}

.itinerary-location__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 0.5em;
}

.itinerary-location__toggle {
    flex: 0 0 auto;
}

.pinball-finder-result__header {
    display: grid;
    gap: 12px;
}

.pinball-finder-result__tile {
    padding-top: 0;
    border-top: 0;
}

.pinball-finder-result__count {
    justify-self: flex-start;
}

.itinerary-pinball {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid rgba(92, 87, 79, 0.12);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.itinerary-pinball:first-child {
    /*padding-top: 0;*/
    /*border-top: 0;*/
}

.itinerary-pinball__media {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.itinerary-pinball__image {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 8px;
    background: #d6d3d1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.itinerary-pinball__body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.itinerary-pinball__title-row,
.location-pinball__title-row,
.pinball-panel__title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.pinball-panel__title-block {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.pinball-panel__title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.itinerary-pinball__name {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
    color: #1f1f1f;
}

.itinerary-pinball:hover .itinerary-pinball__name,
.itinerary-pinball:focus-visible .itinerary-pinball__name {
    color: #0b63ce;
}

.itinerary-pinball:focus-visible {
    outline: 2px solid rgba(11, 99, 206, 0.28);
    outline-offset: 6px;
    border-radius: 12px;
}

.location-panel {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    width: min(360px, 90vw);
    height: 100%;
    background: rgba(244, 241, 234, 0.96);
    box-shadow: -12px 0 28px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 180ms ease;
    backdrop-filter: blur(8px);
}

.pinball-panel__title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.pinball-panel__title-wrap {
    max-width: calc(100% - 52px);
}

.pinball-panel__rarity {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.pinball-panel__occurence {
    margin: 0;
    color: #5c574f;
    font-size: 14px;
    line-height: 1.3;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
}

.pinball-panel__occurence:not(:disabled) {
    cursor: pointer;
    color: #0b63ce;
}

.pinball-panel__occurence:not(:disabled):hover {
    text-decoration: underline;
}

.pinball-panel__occurence:disabled {
    cursor: default;
}

.pinball-panel__content {
    margin-top: 24px;
}

.pinball-panel__media {
    margin-bottom: 18px;
}

.pinball-panel__image {
    display: block;
    width: 100%;
    /*aspect-ratio: 4 / 3;*/
    object-fit: cover;
    border-radius: 16px;
    background: #d6d3d1;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.pinball-panel__meta {
    display: grid;
    gap: 8px;
}

.pinball-panel__meta-line {
    margin: 0;
    color: #2c2c2c;
}

.pinball-panel__links {
    margin-top: 24px;
}

.pinball-panel__links-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.pinball-panel__links-list {
    display: grid;
    gap: 10px;
}

.pinball-panel__link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(92, 87, 79, 0.12);
}

.pinball-panel__link:hover {
    text-decoration: none;
    background: rgba(11, 99, 206, 0.08);
}

.location-panel--open {
    transform: translateX(0);
}

.location-panel__inner {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
    padding: 24px;
    overflow-y: scroll;
}

.location-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.location-panel__header-text {
    min-width: 0;
}

.location-panel__header h1 {
    margin: 0;
    font-size: 24px;
}

.freshness-label--panel {
    margin-bottom: 8px;
}

.location-panel__close {
    border: 0;
    background: transparent;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    color: #2c2c2c;
}

.location-panel__empty,
.location-panel__label {
    color: #5c574f;
}

.location-panel__name {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    color: #1f1f1f;
}

.location-panel__category {
    margin: 8px 0 0;
    font-size: 15px;
    font-style: italic;
    line-height: 1.35;
    color: #a14f2a;
}

.location-panel__content {
    margin-top: 24px;
}

.location-pinballs {
    margin-top: 24px;
}

.location-pinballs-list,
#location-pinballs-list {
    display: grid;
    gap: 10px;
}

.location-pinball {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(92, 87, 79, 0.12);
    text-align: left;
    cursor: pointer;
}

.location-pinball:hover .location-pinball__name,
.location-pinball:focus-visible .location-pinball__name {
    color: #0b63ce;
}

.location-pinball:focus-visible {
    outline: 2px solid rgba(11, 99, 206, 0.28);
    outline-offset: 3px;
}

.location-pinball__name {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    color: #1f1f1f;
}

.rarity-badge {
    display: inline-flex;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(31, 31, 31, 0.15);
}

.rarity-badge--inline {
    margin-top: 1px;
}

.rarity-badge--panel {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
}

.rarity-badge--rare {
    background: #eab308;
}

.rarity-badge--very-rare {
    background: #f97316;
}

.rarity-badge--legendary {
    background: #78350f;
}

.location-pinball__meta {
    margin: 8px 0 0;
    color: #5c574f;
    font-size: 14px;
    line-height: 1.45;
}

.location-pinball__media {
    display: flex;
    justify-content: flex-end;
}

.location-pinball__image {
    display: block;
    width: 110px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 10px;
    background: #d6d3d1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.location-pinball__image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: #5c574f;
    font-size: 12px;
    text-align: center;
}

.map-marker {
    --marker-scale: 1;
    --marker-size: calc(9px * var(--marker-scale));
    width: var(--marker-size);
    height: var(--marker-size);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.map-marker__dot {
    display: block;
    width: var(--marker-size);
    height: var(--marker-size);
    border-radius: 999px;
    background: var(--marker-color, #cc1f1f);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
    transition: width 120ms ease, height 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.map-marker__pin {
    display: none;
    width: calc(var(--marker-size) * 2.2);
    height: calc(var(--marker-size) * 2.2);
    background: center / contain no-repeat url("img/pinned.png");
    /*transform-origin: 50% 85%;*/
    transition: width 120ms ease, height 120ms ease, filter 120ms ease;
}

.map-marker:hover .map-marker__dot {
    width: calc(var(--marker-size) * 1.1);
    height: calc(var(--marker-size) * 1.1);
}

.map-marker:hover .map-marker__pin {
    width: calc(var(--marker-size) * 2.35);
    height: calc(var(--marker-size) * 2.35);
}

.map-marker--highlighted .map-marker__dot {
    width: calc(var(--marker-size) * 1.8);
    /*height: calc(var(--marker-size) * 1.8);*/
}

.map-marker--highlighted .map-marker__pin {
    width: calc(var(--marker-size) * 3);
    height: calc(var(--marker-size) * 3);
}

.map-marker--highlighted .map-marker__dot {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.75);
}

.map-marker--highlighted .map-marker__pin {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
}

.map-marker--waypoint .map-marker__dot {
    display: none;
}

.map-marker--waypoint {
    width: calc(var(--marker-size) * 2.4);
    height: calc(var(--marker-size) * 2.4);
}

.map-marker--waypoint .map-marker__pin {
    display: block;
    animation: waypoint-pin-sway 900ms ease-in-out infinite;
}

.map-marker--location-active:not(.map-marker--waypoint) .map-marker__dot {
    width: calc(var(--marker-size) * 2);
    /*height: calc(var(--marker-size) * 2);*/
    background: #ec4899;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.82);
    animation: location-marker-pulse 900ms ease-in-out infinite;
}

@keyframes waypoint-pin-sway {
    0% {
        transform: rotate(-7deg) scale(2.8);
    }

    50% {
        transform: rotate(7deg) scale(2.8);
    }

    100% {
        transform: rotate(-7deg) scale(2.8);
    }
}

@keyframes location-marker-pulse {
    0% {
        transform: scale(1.42);
    }

    50% {
        transform: scale(1.9);
    }

    100% {
        transform: scale(1.42);
    }
}

.map-marker--hidden {
    display: none;
}

.mapboxgl-popup {
    display: none;
}


/*carte*/

.mapboxgl-map{

    width: 100%;
    height: 100%;

}

@media (max-width: 640px) {
    .route-card {
        top: 0;
        left: 0;
        right: 0;
        width: calc(100vw - 28px);
        padding: 14px;
        padding-top: max(14px, env(safe-area-inset-top));
        border-radius: 0 0 16px 16px;
    }

    .route-form__actions .button {
        flex: 1 1 140px;
    }

    .map-actions {
        width: calc(100vw - 24px);
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        gap: 10px;
    }

    .map-actions .button {
        flex: 1 1 0;
        text-align: center;
    }

    .location-pinball {
        grid-template-columns: 1fr;
    }

    .location-pinball__media {
        justify-content: flex-start;
    }

    .location-panel {
        width: min(360px, 100vw);
    }

    .itinerary-panel {
        width: 100vw;
    }

    .itinerary-panel__inner {
        padding-top: 220px;
    }

    #itinerary-panel {
        top: auto;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100dvh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        transition: transform 220ms ease;
        --itinerary-sheet-peek-height: min(38vh, 320px);
        --itinerary-sheet-offset: calc(100dvh - var(--itinerary-sheet-peek-height));
    }

    #itinerary-panel.itinerary-panel--open[data-sheet-state="collapsed"] {
        transform: translateY(var(--itinerary-sheet-offset));
    }

    #itinerary-panel.itinerary-panel--open[data-sheet-state="expanded"] {
        transform: translateY(0);
    }

    #itinerary-panel.itinerary-panel--dragging {
        transition: none;
    }

    #itinerary-panel .itinerary-panel__inner {
        height: 100dvh;
        padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
        overflow: auto;
    }

    #itinerary-panel .itinerary-sheet-handle {
        display: block;
        padding: 2px 0 6px;
        cursor: ns-resize;
        touch-action: none;
    }

    .itinerary-location__header {
        flex-direction: column;
    }

    .itinerary-pinball {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .itinerary-pinball__image {
        width: 52px;
    }
}
