:root {
    --bg: #0f1215;
    --panel: #171c20;
    --panel-2: #20262b;
    --line: #323a40;
    --text: #f4f6f7;
    --muted: #a8b0b6;
    --accent: #f0c66b;
    --shadow: 0 18px 55px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 12% 0%, rgba(255,255,255,.055), transparent 28rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.topbar,
main,
footer {
    width: min(1500px, calc(100% - 40px));
    margin-inline: auto;
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 36px 0 26px;
}

h1, h2, p { margin-top: 0; }

h1 {
    margin-bottom: 5px;
    font-size: clamp(2rem, 4vw, 3.8rem);
    letter-spacing: -.055em;
    line-height: .95;
}

h2 { margin-bottom: 16px; font-size: 1.25rem; }

.subtitle { margin-bottom: 0; color: var(--muted); }

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .17em;
}

.version, .count {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.04);
    padding: 8px 12px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
}

.search-panel {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(23,28,32,.94);
    padding: 22px;
    box-shadow: var(--shadow);
}

.location-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.field { display: grid; gap: 8px; }
.grow { flex: 1; }

.field span, legend {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
}

input[type="search"] {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    background: #101418;
    padding: 0 15px;
    color: var(--text);
}

input[type="search"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240,198,107,.12);
}

fieldset {
    margin: 20px 0 0;
    border: 0;
    padding: 0;
}

legend { margin-bottom: 10px; }

.choice-row, .filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.choice input, .check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice span, .check span {
    display: block;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #11161a;
    padding: 9px 13px;
    color: var(--muted);
    transition: .18s ease;
}

.choice input:checked + span,
.check input:checked + span {
    border-color: var(--accent);
    background: rgba(240,198,107,.12);
    color: var(--text);
}

.button {
    min-height: 48px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 17px;
    font-weight: 800;
}

.button-primary {
    width: 100%;
    margin-top: 20px;
    background: var(--accent);
    color: #17130b;
}

.button-secondary {
    border-color: var(--line);
    background: var(--panel-2);
    color: var(--text);
}

.button:disabled { cursor: wait; opacity: .55; }

.status {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .83rem;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr);
    gap: 20px;
    min-height: 610px;
}

.map-wrap, .results-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.map-wrap { position: relative; min-height: 610px; }
#map { position: absolute; inset: 0; z-index: 1; }

.map-help {
    position: absolute;
    z-index: 500;
    right: 14px;
    bottom: 14px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 9px;
    background: rgba(15,18,21,.88);
    padding: 8px 10px;
    color: #fff;
    font-size: .72rem;
    backdrop-filter: blur(8px);
}

.results-panel {
    display: flex;
    flex-direction: column;
    max-height: 610px;
}

.results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 20px;
}

.results-heading h2 { margin: 0; }

.results {
    overflow-y: auto;
    padding: 12px;
}

.empty-state {
    display: grid;
    place-content: center;
    min-height: 260px;
    padding: 30px;
    text-align: center;
    color: var(--muted);
}

.empty-state strong { margin-bottom: 7px; color: var(--text); }

.spot-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #13181c;
    padding: 10px;
}

.spot-card + .spot-card { margin-top: 9px; }

.spot-main {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    text-align: left;
}

.rank {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: .73rem;
    font-weight: 800;
}

.spot-copy { display: grid; gap: 3px; min-width: 0; }
.spot-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot-copy span { color: var(--muted); font-size: .76rem; }

.score {
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 900;
}
.score small { color: var(--muted); font-size: .62rem; }

.spot-card > p {
    margin: 10px 0 0 40px;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.45;
}

.spot-actions {
    display: flex;
    gap: 12px;
    margin: 10px 0 0 40px;
}

.spot-actions button, .spot-actions a {
    cursor: pointer;
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--accent);
    font-size: .75rem;
    font-weight: 750;
    text-decoration: none;
}

.spot-marker {
    display: grid !important;
    place-items: center;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #15191d;
    color: var(--accent);
    box-shadow: 0 6px 18px rgba(0,0,0,.38);
    font-size: .75rem;
    font-weight: 900;
}

.popup { display: grid; gap: 5px; color: #111; }
.popup span { color: #555; }

footer {
    padding: 24px 0 35px;
    color: var(--muted);
    font-size: .75rem;
    text-align: center;
}

@media (max-width: 900px) {
    .workspace { grid-template-columns: 1fr; }
    .map-wrap { min-height: 470px; }
    .results-panel { max-height: none; }
}

@media (max-width: 620px) {
    .topbar, main, footer { width: min(100% - 22px, 1500px); }
    .topbar { padding-top: 24px; }
    .location-row { align-items: stretch; flex-direction: column; }
    .button-secondary { width: 100%; }
    .search-panel { padding: 16px; border-radius: 16px; }
    .filter-grid .check { flex: 1 1 calc(50% - 8px); }
    .check span { height: 100%; text-align: center; }
    .map-wrap { min-height: 420px; border-radius: 16px; }
    .map-help { left: 14px; right: auto; }
}

/* V1.1.0 — finition UI, sans modification du moteur */
.topbar-actions { display:flex; align-items:center; gap:9px; }
.search-area-button {
    position:absolute; z-index:600; top:14px; left:50%; transform:translateX(-50%);
    min-height:42px; cursor:pointer; border:1px solid rgba(255,255,255,.22);
    border-radius:999px; background:#15191d; padding:0 17px; color:#fff;
    box-shadow:0 8px 28px rgba(0,0,0,.28); font-size:.78rem; font-weight:850;
}
.search-area-button[hidden] { display:none; }
.search-area-button:disabled { cursor:wait; opacity:.6; }


@media (max-width:620px) {
    .topbar { align-items:flex-start; }
    .topbar-actions { flex-direction:column-reverse; align-items:flex-end; gap:7px; }
    .search-area-button { top:12px; max-width:calc(100% - 28px); width:max-content; white-space:nowrap; }
}


/* Spotter Photo — bullets par type photographique */
.spot-meta, .popup-type {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.type-bullet {
    display: inline-block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #8a9298;
    box-shadow: 0 0 0 2px rgba(255,255,255,.08);
}
.type-bullet--viewpoint { background: #9b6cff; }
.type-bullet--nature { background: #55b96a; }
.type-bullet--water { background: #4da3ff; }
.type-bullet--heritage { background: #e59a45; }
.type-bullet--architecture { background: #d96459; }
.type-bullet--urban { background: #e5c94f; }
.type-bullet--unknown { background: #8a9298; }

/* Marqueurs carte colorés selon le type photographique */
.spot-marker--viewpoint { background: #9b6cff; color: #fff; }
.spot-marker--nature { background: #55b96a; color: #fff; }
.spot-marker--water { background: #4da3ff; color: #fff; }
.spot-marker--heritage { background: #e59a45; color: #fff; }
.spot-marker--architecture { background: #d96459; color: #fff; }
.spot-marker--urban { background: #e5c94f; color: #17130b; }
.spot-marker--unknown { background: #8a9298; color: #fff; }

/* V1.1.x — filtres de recherche harmonisés avec les types photo */
.type-filter span {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
}

.type-filter span::before {
    content: "";
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--type-color, #8a9298);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--type-color, #8a9298) 22%, transparent);
}

.type-filter--viewpoint { --type-color: #9b6cff; --type-tint: rgba(155,108,255,.12); }
.type-filter--nature { --type-color: #55b96a; --type-tint: rgba(85,185,106,.12); }
.type-filter--water { --type-color: #4da3ff; --type-tint: rgba(77,163,255,.12); }
.type-filter--heritage { --type-color: #e59a45; --type-tint: rgba(229,154,69,.12); }
.type-filter--architecture { --type-color: #d96459; --type-tint: rgba(217,100,89,.12); }
.type-filter--urban { --type-color: #e5c94f; --type-tint: rgba(229,201,79,.12); }

.type-filter input:checked + span {
    border-color: var(--type-color);
    background: var(--type-tint);
    color: var(--text);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--type-color) 20%, transparent);
}

.type-filter input:focus-visible + span {
    outline: 2px solid var(--type-color);
    outline-offset: 2px;
}


