:root {
    --ink: #14211e;
    --pine: #1c3d36;
    --paper: #f4efe6;
    --mist: rgba(247, 242, 234, 0.88);
    --line: rgba(20, 33, 30, 0.1);
    --ember: #de5a38;
    --ember-dark: #b84328;
    --shadow: 0 18px 50px rgba(20, 33, 30, 0.16);
    --radius: 22px;
    --font: "Outfit", system-ui, sans-serif;
    --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    color: var(--ink);
    background: #d9d3c8;
}

#map {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.leaflet-control-attribution {
    font-size: 10px;
    background: rgba(255,255,255,.72) !important;
}

.ranking {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    left: 16px;
    width: min(320px, calc(100vw - 32px));
    z-index: 5;
    background: var(--mist);
    backdrop-filter: blur(18px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.ranking__head {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}

.ranking__head em {
    display: block;
    font-style: normal;
    font-family: var(--display);
    font-size: 18px;
}

.ranking__head span {
    font-size: 13px;
    color: rgba(20, 33, 30, 0.7);
}

.ranking__chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: rotate(45deg);
    transition: transform .25s ease;
    margin-right: 6px;
}

.ranking.is-collapsed .ranking__chevron {
    transform: rotate(-135deg);
}

.ranking.is-collapsed .ranking__list {
    display: none;
}

.ranking__list {
    list-style: none;
    margin: 0;
    padding: 0 8px 10px;
    max-height: min(46vh, 420px);
    overflow: auto;
}

.ranking__item {
    width: 100%;
    border: 0;
    background: transparent;
    display: grid;
    grid-template-columns: 22px 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 8px;
    border-radius: 14px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}

.ranking__item:hover {
    background: rgba(255,255,255,.55);
}

.ranking__n {
    font-family: var(--display);
    font-size: 15px;
    color: rgba(20, 33, 30, 0.45);
}

.ranking__glyph {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cat);
    color: #fff;
    display: grid;
    place-items: center;
}

.ranking__glyph svg {
    width: 15px;
    height: 15px;
    display: block;
}

.ranking__cat {
    display: inline-block;
    color: #fff;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    margin-bottom: 3px;
}

.ranking__rua {
    display: block;
    font-size: 13.5px;
    line-height: 1.25;
}

.ranking__apoios {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    font-size: 15px;
}

.ranking__vazio {
    padding: 8px 16px 16px;
    font-size: 13px;
    color: rgba(20, 33, 30, 0.65);
}

.fab {
    position: absolute;
    right: 18px;
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: var(--ember);
    color: #fff;
    font: inherit;
    font-weight: 560;
    font-size: 15px;
    padding: 12px 20px 12px 14px;
    border-radius: 999px;
    box-shadow: 0 16px 36px rgba(222, 90, 56, 0.38);
    cursor: grab;
    touch-action: none;
    user-select: none;
    text-align: left;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

.fab__txt {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.15;
}

.fab__txt strong { font-weight: 560; }
.fab__txt small {
    font-size: 11px;
    font-weight: 430;
    opacity: 0.82;
}

.fab:hover { background: var(--ember-dark); }
.fab.is-dragging {
    cursor: grabbing;
    opacity: 0.35;
}

.fab__plus {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    position: relative;
    flex-shrink: 0;
}

.fab__plus::before,
.fab__plus::after {
    content: "";
    position: absolute;
    background: #fff;
    border-radius: 2px;
}
.fab__plus::before { width: 10px; height: 2px; left: 6px; top: 10px; }
.fab__plus::after { width: 2px; height: 10px; left: 10px; top: 6px; }

.ghost-pin {
    position: fixed;
    z-index: 20;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -34px;
    border-radius: 50% 50% 50% 6px;
    transform: rotate(-45deg);
    background: var(--ember);
    border: 2px solid #fff;
    box-shadow: 0 10px 22px rgba(222, 90, 56, 0.45);
    pointer-events: none;
}

.ghost-pin::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    left: 11px;
    top: 11px;
}

.map-hint {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    margin: 0;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow);
    white-space: nowrap;
    pointer-events: none;
}

.pin--draft {
    width: 34px;
    height: 34px;
    background: var(--ember);
    animation: pin-pulse 1.4s ease-in-out infinite;
}

@keyframes pin-pulse {
    50% { transform: rotate(-45deg) scale(1.08); }
}

body.is-placing #map {
    cursor: crosshair;
}

.sheet {
    position: absolute;
    z-index: 9;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(110%);
    width: min(460px, 100%);
    max-height: min(92vh, 760px);
    overflow: auto;
    background: var(--paper);
    border-radius: 28px 28px 0 0;
    box-shadow: var(--shadow);
    padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
    transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}

.sheet.is-open { transform: translateX(-50%) translateY(0); }

.sheet__handle {
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: rgba(20, 33, 30, 0.16);
    margin: 6px auto 8px;
}

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

.sheet__kicker {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(20, 33, 30, 0.5);
}

.sheet__head h2 {
    margin: 2px 0 0;
    font-family: var(--display);
    font-size: 26px;
    font-weight: 560;
    letter-spacing: -0.03em;
}

.icon-btn {
    border: 0;
    background: rgba(20, 33, 30, 0.06);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    color: var(--ink);
}

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

.camera input { display: none; }

.camera__frame {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 168px;
    border-radius: 20px;
    border: 1.5px dashed rgba(20, 33, 30, 0.22);
    background:
        radial-gradient(circle at 20% 20%, rgba(222, 90, 56, 0.08), transparent 40%),
        #efe9de;
    cursor: pointer;
    text-align: center;
    padding: 18px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.camera__frame span { font-weight: 560; }
.camera__frame em { font-style: normal; font-weight: 430; opacity: 0.7; }
.camera__frame small { color: rgba(20, 33, 30, 0.55); font-size: 12px; }

.camera__frame.has-photo span,
.camera__frame.has-photo small,
.camera__frame.has-photo .camera__icon { display: none; }

.camera__icon {
    width: 42px;
    height: 32px;
    border: 2px solid var(--ink);
    border-radius: 8px;
    position: relative;
    margin-bottom: 6px;
}

.camera__icon::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    left: 14px;
    top: 8px;
}

.cats {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.cats legend {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(20, 33, 30, 0.5);
    margin-bottom: 8px;
}

.cat input { position: absolute; opacity: 0; pointer-events: none; }

.cat span {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 64px;
    padding: 12px;
    border-radius: 16px;
    background: #fff;
    border: 1.5px solid transparent;
    box-shadow: 0 1px 0 rgba(20, 33, 30, 0.04);
    cursor: pointer;
}

.cat input:checked + span {
    border-color: var(--cat);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 22%, transparent);
}

.cat__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--cat);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.cat__icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.cat__copy {
    min-width: 0;
}

.cat b { font-weight: 560; font-size: 14px; display: block; }

.cat small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(20, 33, 30, 0.55);
    font-weight: 400;
}

.rua {
    background: #fff;
    border-radius: 16px;
    padding: 12px 14px;
}

.rua__label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(20, 33, 30, 0.5);
}

.rua strong { font-size: 15px; font-weight: 560; }

.field span { display: block; font-size: 13px; margin-bottom: 6px; }
.field em { font-style: normal; color: rgba(20, 33, 30, 0.45); }
.field input,
.field textarea {
    width: 100%;
    border: 0;
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    font: inherit;
    font-size: 16px;
}
.field textarea {
    resize: none;
    min-height: 88px;
    line-height: 1.4;
}
.field small {
    display: block;
    margin-top: 6px;
    color: rgba(20, 33, 30, 0.5);
    font-size: 12px;
}

.form__erro {
    margin: 0;
    color: #9b2c1a;
    font-size: 13px;
}

.btn-enviar {
    border: 0;
    background: var(--pine);
    color: #fff;
    font: inherit;
    font-weight: 560;
    font-size: 16px;
    padding: 15px;
    border-radius: 16px;
    cursor: pointer;
}

.btn-enviar:disabled { opacity: 0.55; cursor: wait; }

.toast {
    position: absolute;
    z-index: 12;
    left: 50%;
    bottom: calc(92px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    padding: 11px 16px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: var(--shadow);
    max-width: calc(100% - 32px);
}

.leaflet-div-icon.map-marker {
    background: none;
    border: none;
}

.map-pin {
    position: relative;
    width: 36px;
    height: 44px;
    filter: drop-shadow(0 5px 10px rgba(20, 33, 30, 0.28));
}

.map-pin__glyph {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cat);
    border: 2px solid #fff;
    color: #fff;
    display: grid;
    place-items: center;
}

.map-pin__glyph svg {
    width: 18px;
    height: 18px;
    display: block;
}

.map-pin::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 1px;
    width: 10px;
    height: 10px;
    background: var(--cat);
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateX(-50%) rotate(45deg);
}

.legend {
    position: absolute;
    z-index: 5;
    left: 58px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 8px;
    max-width: calc(100vw - 200px);
    background: var(--mist);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.legend li {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 560;
    padding: 2px 6px 2px 2px;
}

.legend__icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--cat);
    color: #fff;
    display: grid;
    place-items: center;
}

.legend__icon svg {
    width: 12px;
    height: 12px;
    display: block;
}

.pin {
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 6px;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 6px 14px rgba(20, 33, 30, 0.28);
}

.pin span {
    display: block;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    margin: 8px auto 0;
}

.popup {
    width: 220px;
}

.popup img, .popup .popup__img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 12px;
    background: #ece6db;
    display: block;
}

.popup__img--icon {
    display: grid;
    place-items: center;
    background: var(--cat);
    color: #fff;
}

.popup__img--icon svg {
    width: 48px;
    height: 48px;
}

.popup h3 {
    margin: 8px 0 2px;
    font-size: 14px;
    font-family: var(--display);
}

.popup p {
    margin: 0 0 8px;
    font-size: 12px;
    color: rgba(20, 33, 30, 0.7);
}

.popup__desc {
    margin: -4px 0 8px;
    font-size: 12px;
    color: var(--ink);
    line-height: 1.35;
}

.btn-apoiar {
    width: 100%;
    border: 0;
    background: var(--ember);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 560;
    padding: 9px 10px;
    border-radius: 11px;
    cursor: pointer;
}

.btn-apoiar.is-on {
    background: var(--pine);
}

.leaflet-popup-content-wrapper {
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.leaflet-popup-content { margin: 10px; }

@media (min-width: 860px) {
    .sheet {
        left: auto;
        right: 24px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%) translateX(24px);
        border-radius: 28px;
        max-height: calc(100vh - 48px);
        width: 400px;
        opacity: 0;
        pointer-events: none;
    }
    .sheet.is-open {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
        pointer-events: auto;
    }
}

.onboard {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: end center;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    background: rgba(20, 33, 30, 0.46);
    backdrop-filter: blur(8px);
}

.onboard[hidden] { display: none; }

.onboard__card {
    width: min(420px, 100%);
    background: var(--paper);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px 22px 20px;
    text-align: left;
}

.onboard__kicker {
    margin: 0 0 14px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(20, 33, 30, 0.5);
}

.onboard__visual {
    height: 88px;
    border-radius: 20px;
    margin-bottom: 16px;
    background:
        radial-gradient(circle at 18% 20%, rgba(222, 90, 56, 0.16), transparent 42%),
        #efe9de;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.onboard__pin {
    width: 34px;
    height: 34px;
    border-radius: 50% 50% 50% 6px;
    transform: rotate(-45deg);
    background: var(--ember);
    border: 2px solid #fff;
    box-shadow: 0 10px 22px rgba(222, 90, 56, 0.4);
    position: relative;
    transition: transform .35s ease, background .35s ease;
}

.onboard__pin::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    left: 11px;
    top: 11px;
}

.onboard[data-step="1"] .onboard__visual {
    background:
        linear-gradient(90deg, transparent 0 42%, rgba(222, 90, 56, 0.18) 58%, transparent 78%),
        radial-gradient(circle at 78% 55%, rgba(222, 90, 56, 0.22), transparent 34%),
        #efe9de;
}

.onboard[data-step="1"] .onboard__pin {
    transform: rotate(-45deg) translate(48px, -6px);
}

.onboard[data-step="2"] .onboard__visual {
    background:
        radial-gradient(circle at 50% 50%, rgba(28, 61, 54, 0.16), transparent 46%),
        #efe9de;
}

.onboard[data-step="2"] .onboard__pin {
    background: var(--pine);
}

.onboard__card h2 {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: 28px;
    font-weight: 560;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.onboard__card p#onboard-texto {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.45;
    color: rgba(20, 33, 30, 0.72);
}

.onboard__dots {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.onboard__dot {
    width: 7px;
    height: 7px;
    border: 0;
    padding: 0;
    border-radius: 99px;
    background: rgba(20, 33, 30, 0.18);
    cursor: pointer;
}

.onboard__dot.is-on {
    width: 18px;
    background: var(--pine);
}

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

.onboard__skip {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: rgba(20, 33, 30, 0.55);
    cursor: pointer;
    padding: 10px 4px;
}

.onboard__next {
    margin-left: auto;
    border: 0;
    background: var(--ember);
    color: #fff;
    font: inherit;
    font-weight: 560;
    font-size: 15px;
    padding: 12px 18px;
    border-radius: 999px;
    cursor: pointer;
}

.fab.is-hinting {
    animation: fab-hint 1.1s ease-in-out 2;
}

@keyframes fab-hint {
    50% { transform: scale(1.06); }
}

@media (min-width: 860px) {
    .onboard {
        place-items: center;
        padding: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sheet, .fab, .ranking__chevron, .onboard__pin { transition: none; }
    .fab.is-hinting { animation: none; }
}
