:root {
    color-scheme: light;
    --cyan:  #00AACB;
    --dark:  #212121;
    --col-a: #00a9c9;
    --col-b: #0069b4;
    --col-c: #ec6608;
    --col-d: #8B4513;
    --col-e: #ae0f0a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* iOS Safari: exclut la barre d'adresse */
    width: 100vw;
    background: #e8e8e8;
}

/* ─── Map ─────────────────────────────────── */
#map {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ─── UI Overlay ──────────────────────────── */
#ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* Header */
#app-header {
    pointer-events: auto;
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--cyan);
    border-radius: 20px;
    padding: 4px 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

#app-header h1 {
    color: #fff;
    font-size: 26px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
    letter-spacing: 0.3px;
}

/* ─── Left UI ─────────────────────────────── */
#left-ui {
    pointer-events: auto;
    position: absolute;
    top: 72px;
    left: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#circuit-label {
    background: rgba(217, 217, 217, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
    border-radius: 18px;
    padding: 3px 12px;
}

#circuit-name {
    font-size: 19px;
    font-weight: 500;
    color: #000;
    text-shadow: 0 2px 4px rgba(6,9,174,0.35);
    white-space: nowrap;
}

#circuit-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.circuit-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid transparent;
    background: #888; /* remplacé par JS après loadData() */
    font-size: 0;     /* pas de lettre */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: opacity 0.15s, border-color 0.15s, transform 0.1s;
    opacity: 0.55;
}

.circuit-btn.active {
    opacity: 1;
    border-color: rgba(255,255,255,0.9);
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 4px 10px rgba(0,0,0,0.3);
}

/* ─── Right UI ────────────────────────────── */
#right-ui {
    pointer-events: auto;
    position: absolute;
    top: 72px;
    right: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#visit-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

#counter-num {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

#counter-lbl {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

#compass {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--dark);
    color: #E8E8E8;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    margin-top: 110px;
    cursor: pointer;
    transition: transform 0.3s ease;
    user-select: none;
}

#locate-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--dark);
    color: #E8E8E8;
    font-size: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

/* ─── POI Panel ───────────────────────────── */
#poi-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 480px;
    margin: 0 auto;
}

#poi-panel.open {
    transform: translateY(0);
}

#panel-inner {
    background: rgba(232, 232, 232, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 28px 28px 0 0;
    padding: 6px 18px calc(28px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    cursor: grab;
}

#panel-inner:active { cursor: grabbing; }

/* Drag handle */
#panel-handle-bar {
    width: 44px;
    height: 5px;
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    margin: 4px auto 10px;
}

/* Panel summary: color tag + name + close */
#panel-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

#panel-color-tag {
    width: 38px;
    height: 14px;
    border-radius: 5px;
    flex-shrink: 0;
}

#panel-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

#panel-name {
    font-size: 15px;
    font-weight: 700;
    color: #000;
    flex: 1;
    min-width: 0;
}

/* Navigation entre POIs empilés au même endroit (cf. ui.js findStack) */
.stack-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.stack-nav button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.08);
    color: #000;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stack-nav button:active { background: rgba(0,0,0,0.18); }

#stack-counter {
    font-size: 11px;
    font-weight: 600;
    color: rgba(0,0,0,0.55);
    min-width: 28px;
    text-align: center;
}

#btn-close-panel {
    background: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Action buttons */
#panel-btns {
    display: flex;
    gap: 10px;
}

.panel-action {
    flex: 1;
    border: none;
    border-radius: 12px;
    background: #D9D9D9;
    padding: 10px 6px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #111;
    transition: background 0.15s, color 0.15s;
}

.panel-action span:first-child {
    font-size: 22px;
    line-height: 1;
}

#btn-nav {
    background: #0E7EFF;
    color: #fff;
}

#btn-nav:active { background: #0060d0; }

#btn-visit.visited {
    background: #44C039;
    color: #fff;
}

/* Expandable content (photo + description) */
#panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

#content-body {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding-top: 16px;
}

#content-img {
    width: 115px;
    height: 84px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #ccc;
}

#content-desc {
    font-size: 11.5px;
    line-height: 1.55;
    color: #111;
}

/* ─── Navigation banner ──────────────────── */
#nav-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    max-width: 480px;
    margin: 0 auto;
    pointer-events: none;
}

#nav-banner.active {
    transform: translateY(0);
    pointer-events: auto;
}

#nav-inner {
    background: rgba(22, 22, 26, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px 24px 0 0;
    padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 -4px 32px rgba(0,0,0,0.45);
}

#nav-banner.arrived #nav-inner {
    background: rgba(30, 130, 60, 0.97);
}

#nav-color-bar {
    width: 5px;
    min-height: 52px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

#nav-banner.arrived #nav-color-bar {
    background-color: rgba(255,255,255,0.45) !important;
}

#nav-details {
    flex: 1;
    min-width: 0;
}

#nav-poi-name {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 3px;
}

#nav-eta {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transition: font-size 0.2s;
}

#nav-banner.arrived #nav-eta {
    font-size: 20px;
}

#nav-exit {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: #fff;
    transition: background 0.15s;
}

#nav-exit:active {
    background: rgba(255,255,255,0.22);
}

#nav-exit .material-icons {
    font-size: 20px;
}

/* ─── Artist modal ────────────────────────── */
#artist-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#artist-modal.open {
    opacity: 1;
    pointer-events: auto;
}

#artist-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

#artist-modal-sheet {
    position: relative;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 8px 22px 36px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

#artist-modal.open #artist-modal-sheet {
    transform: translateY(0);
}

#artist-modal-handle {
    width: 44px;
    height: 5px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    margin: 4px auto 14px;
}

#artist-modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: #eee;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

#artist-modal-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 8px;
}

#artist-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ddd; /* remplacé par JS avec la couleur du circuit */
    flex-shrink: 0;
}

#artist-text {
    flex: 1;
}

#artist-name-modal {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin-bottom: 8px;
}

#artist-bio-modal {
    font-size: 13px;
    line-height: 1.6;
    color: #444;
}

/* ─── User location marker ────────────────── */
.loc-wrap {
    position: relative;
    width: 24px;
    height: 24px;
    overflow: visible;
}

.loc-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #1168e8;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(17,104,232,0.55);
    top: 5px;
    left: 5px;
    z-index: 2;
}

.loc-beam {
    position: absolute;
    width: 36px;
    height: 36px;
    /* fan opening upward (north) when rotate(0deg) */
    background: conic-gradient(from 340deg at 50% 100%, rgba(17,104,232,0.3) 40deg, transparent 0);
    bottom: 12px;   /* anchored at dot centre */
    left: -6px;     /* centred in 24px container: (24-36)/2 */
    transform-origin: 50% 100%;
    transform: rotate(0deg);
    display: none;
    z-index: 1;
}

/* ─── Circuit button icons ─────────────────── */
.circuit-btn .material-icons {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1;
    display: block;
}

/* ─── Loading screen ─────────────────────── */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #00AACB;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-content {
    text-align: center;
    color: #fff;
    user-select: none;
}

#loading-title {
    font-size: 46px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#loading-subtitle {
    font-size: 15px;
    opacity: 0.82;
    margin-top: 6px;
    letter-spacing: 0.2px;
}

#loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    margin: 28px auto 0;
    animation: buzzart-spin 0.85s linear infinite;
}

@keyframes buzzart-spin {
    to { transform: rotate(360deg); }
}

/* ─── Leaflet marker overrides ────────────── */
.poi-marker {
    background: none !important;
    border: none !important;
    pointer-events: auto; /* explicite : évite tout conflit avec pointer-events hérité */
}

.marker-dot {
    display: block;
    width: 16px;
    height: 16px;
    margin: 13px; /* centre dans le container 42px : (42-16)/2 = 13 */
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    outline: 1px solid rgba(255,255,255,0.6);
    box-shadow: 0 2px 5px rgba(0,0,0,0.35);
    cursor: pointer;
    transform-origin: center center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s;
}

.marker-dot.visited {
    opacity: 0.4;
}

.marker-dot.selected {
    transform: scale(1.65);
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.5), 0 4px 14px rgba(0,0,0,0.5);
    opacity: 1 !important;
}

/* ─── Prochain POI button ─────────────────── */
#next-poi-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--cyan);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.12s, background 0.15s;
}

#next-poi-btn:active {
    transform: scale(0.93);
    background: #0090aa;
}

#next-poi-btn .material-icons { font-size: 22px; }

/* ─── Proximity toast ─────────────────────── */
#proximity-toast {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 50;
    background: rgba(22, 22, 26, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    padding: 10px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    max-width: calc(100vw - 40px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

#proximity-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#proximity-toast .material-icons {
    font-size: 16px;
    color: #4CAF50;
    flex-shrink: 0;
}

#proximity-toast-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
