* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    background: #101010;
    font-family: Inter, Arial, sans-serif;
    overflow: hidden;
}

button {
    font: inherit;
}

button:focus,
button:active,
button:focus-visible {
    outline: none;
    box-shadow: none;
}

#map {
    width: 100%;
    height: 100%;
    background: #181818 url("../../gta5_game_ng_map/4/-1/0.jpg") repeat;
}

#map.leaflet-container {
    background: #181818 url("../../gta5_game_ng_map/4/-1/0.jpg") repeat;
}

.leaflet-control-attribution {
    display: none;
}

.leaflet-top.leaflet-right {
    top: 12px;
    right: 12px;
}

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.leaflet-control-zoom a {
    background: rgba(18, 18, 18, 0.94) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.map-menu {
    position: absolute;
    z-index: 1000;
    top: 12px;
    left: 12px;
    width: 400px;
    max-width: calc(100vw - 88px);
    max-height: calc(100vh - 24px);
    color: #ffffff;
    background: rgba(15, 15, 15, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
    overflow: hidden;
}

.leaflet-touch .leaflet-control-zoom a {
    width: 34px;
    height: 34px;
    line-height: 34px;
}

.map-menu.is-closed {
    width: 48px;
    height: 48px;
}

.map-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.map-menu-toggle {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
    cursor: pointer;
}

.map-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.map-menu-title {
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.map-menu-sync {
    flex: 0 0 auto;
}

.map-menu.is-closed .map-menu-title,
.map-menu.is-closed .map-menu-sync,
.map-menu.is-closed .map-menu-body {
    display: none;
}

.map-menu-body {
    max-height: calc(100vh - 68px);
    overflow: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.24) rgba(255, 255, 255, 0.06);
}

.map-menu-body::-webkit-scrollbar {
    width: 10px;
}

.map-menu-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
}

.map-menu-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border: 2px solid rgba(16, 16, 16, 0.92);
    border-radius: 999px;
}

.map-menu-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.34);
}

.menu-group {
    margin-bottom: 8px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.menu-group-header {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}

.menu-group-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-category {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.menu-category-header {
    display: grid;
    grid-template-columns: 16px 24px minmax(0, 1fr) auto 54px;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 8px 9px 14px;
    color: #ffffff;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.menu-category-header.has-multiple-icons {
    grid-template-columns: 16px 58px minmax(0, 1fr) auto 54px;
}

.menu-category-header.has-many-icons {
    grid-template-columns: 16px 54px minmax(0, 1fr) auto 54px;
    min-height: 60px;
}

.menu-category-header:hover,
.menu-location-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.menu-arrow {
    width: 16px;
    opacity: 0.75;
    flex: 0 0 auto;
    text-align: center;
    user-select: none;
}

.menu-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    text-shadow: none;
}

.menu-count {
    font-size: 12px;
    min-width: 44px;
    color: rgba(255, 255, 255, 0.74);
    opacity: 1;
    text-align: right;
    white-space: nowrap;
}

.menu-category-actions {
    width: 54px;
    min-width: 54px;
}

.small-button {
    width: 54px;
    min-width: 54px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-size: 12px;
    cursor: pointer;
}

.small-button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.small-button.is-muted {
    color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.05);
}

.menu-location-list {
    display: none;
    padding: 4px 0 8px;
}

.menu-category.is-expanded .menu-location-list {
    display: block;
}

.menu-location-row {
    display: grid;
    grid-template-columns: 26px 24px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 32px;
    background: transparent;
}

.menu-location-main {
    min-width: 0;
    width: 100%;
    padding: 0;
    color: #ffffff;
    background: transparent;
    border: 0;
    outline: none;
    box-shadow: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.menu-location-main .menu-name {
    display: block;
}

.status-toggle {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: 0.15s ease;
}

.status-toggle::after {
    content: "";
    width: 7px;
    height: 12px;
    border-right: 3px solid transparent;
    border-bottom: 3px solid transparent;
    background: transparent;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: 0.15s ease;
}

.status-toggle:hover {
    border-color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.1);
}

.status-toggle.is-completed {
    border-color: rgba(39, 212, 90, 0.95);
    background: rgba(39, 212, 90, 0.16);
}

.status-toggle.is-completed::after {
    width: 7px;
    height: 12px;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
    background: transparent;
    transform: rotate(45deg) translate(-1px, -1px);
}

.sprite-icon {
    display: block;
    background-repeat: no-repeat;
    background-size: auto;
    image-rendering: auto;
}

.menu-sprite-icon {
    transform: scale(0.72);
    transform-origin: center;
    flex: 0 0 auto;
}

.menu-icon-holder,
.menu-category-header > .sprite-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.menu-icon-holder-multiple {
    width: 58px;
    justify-content: flex-start;
    gap: 0;
}

.menu-icon-holder-multiple .menu-sprite-icon + .menu-sprite-icon {
    margin-left: -8px;
}

.menu-category-header.has-many-icons .menu-icon-holder-multiple {
    width: 54px;
    height: 44px;
    display: grid;
    grid-template-columns: repeat(2, 24px);
    grid-auto-rows: 22px;
    align-content: center;
    justify-content: center;
    column-gap: 0;
    row-gap: 0;
}

.menu-category-header.has-many-icons .menu-sprite-icon {
    transform: scale(0.56);
}

.menu-category-header.has-many-icons .menu-sprite-icon + .menu-sprite-icon {
    margin-left: 0;
}

.map-sprite-icon {
    width: 33px;
    height: 33px;
    transform: scale(var(--map-marker-scale, 1));
    transform-origin: center;
}

.fallback-map-icon {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 999px;
    background: #ff4444;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
    transform: scale(var(--map-marker-scale, 1));
    transform-origin: center;
}

.fallback-menu-icon {
    width: 14px;
    height: 14px;
    display: block;
    border-radius: 999px;
    background: #ff4444;
    border: 2px solid #ffffff;
}

.map-marker-completed {
    opacity: 0.28;
    filter: grayscale(0.8);
}

.popup {
    min-width: 260px;
    max-width: min(340px, calc(100vw - 54px));
}

.popup-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.popup-description {
    margin: 9px 0 2px;
    padding: 8px 9px;
    color: var(--popup-description-color, #101010);
    background: rgba(255, 199, 44, 0.14);
    border: 1px solid rgba(255, 199, 44, 0.34);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.35;
}

.popup-image {
    display: block;
    width: 300px;
    max-width: 100%;
    margin: 8px 0;
    border-radius: 10px;
    cursor: zoom-in;
}

.image-viewer {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 14px;
    background: rgba(0, 0, 0, 0.82);
}

.image-viewer.is-open {
    display: flex;
}

.image-viewer-shell {
    display: flex;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 48px);
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.image-viewer-frame {
    max-width: 100%;
    max-height: calc(100vh - 96px);
    overflow: auto;
    border-radius: 10px;
}

.image-viewer-image {
    display: block;
    max-width: min(96vw, 1440px);
    max-height: calc(100vh - 104px);
    height: auto;
    user-select: auto;
    cursor: zoom-in;
}

.image-viewer-image.is-zoomed {
    max-width: none;
    max-height: none;
    width: auto;
    cursor: zoom-out;
}

.image-viewer-toolbar {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
}

.image-viewer-button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(24, 24, 24, 0.9);
    cursor: pointer;
}

.image-viewer-button:hover {
    background: rgba(48, 48, 48, 0.94);
}

.popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.popup-button {
    padding: 5px 8px;
    color: #ffffff;
    background: #303030;
    border: 1px solid #555555;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.popup-button:hover {
    background: #3d3d3d;
}

.modal-backdrop {
    position: fixed;
    z-index: 1900;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.68);
}

.modal-backdrop.is-open {
    display: flex;
}

.sync-modal {
    width: min(440px, 100%);
    color: #ffffff;
    background: rgba(18, 18, 18, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.sync-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 700;
}

.sync-modal-body {
    padding: 14px;
}

.sync-note {
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.42;
}

.sync-input {
    width: 100%;
    height: 38px;
    margin-top: 6px;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
}

.custom-select {
    position: relative;
    width: 100%;
    margin-top: 6px;
}

.custom-select-button {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    cursor: pointer;
}

.custom-select-arrow {
    width: 8px;
    height: 8px;
    display: block;
    flex: 0 0 auto;
    margin-top: -4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    color: rgba(255, 255, 255, 0.68);
    transform: rotate(45deg);
}

.custom-select-menu {
    position: absolute;
    z-index: 4;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    padding: 5px;
    background: rgba(24, 24, 24, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.custom-select.is-open .custom-select-menu {
    display: block;
}

.custom-select-option {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    color: #ffffff;
    background: transparent;
    border: 0;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
}

.custom-select-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

.custom-select-option.is-selected {
    color: #ffffff;
}

.custom-select-option.is-selected::after {
    content: "";
    width: 6px;
    height: 10px;
    margin-left: 8px;
    border-right: 2px solid rgba(39, 212, 90, 0.95);
    border-bottom: 2px solid rgba(39, 212, 90, 0.95);
    transform: rotate(45deg) translateY(-1px);
}

.sync-field {
    display: block;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.86);
}

.sync-field-title {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.platform-note {
    padding: 1px 5px;
    border: 1px solid rgba(39, 212, 90, 0.3);
    border-radius: 4px;
    background: rgba(39, 212, 90, 0.08);
    color: rgba(89, 232, 132, 0.95);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.sync-status {
    min-height: 20px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
}

.sync-status.is-error {
    color: #ff6b6b;
}

.sync-spinner {
    width: 16px;
    height: 16px;
    display: none;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
}

.sync-modal.is-loading .sync-spinner {
    display: inline-block;
}

.sync-spinner.is-visible {
    display: inline-block;
}

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

.sync-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 14px 14px;
}

.sync-modal-actions .popup-button {
    min-width: 86px;
    height: 34px;
    padding: 0 14px;
    font-size: 12px;
}

.turnstile-box,
.cf-turnstile,
.cf-turnstile > div,
.cf-turnstile iframe {
    width: 100% !important;
}

.turnstile-box {
    width: 100%;
    min-height: 65px;
    margin-bottom: 8px;
    overflow: hidden;
}

.sync-busy-overlay {
    position: fixed;
    z-index: 2600;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
}

.sync-busy-overlay.is-open {
    display: flex;
}

.sync-busy-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: #ffffff;
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
    font-size: 13px;
}

.sync-toast {
    position: fixed;
    z-index: 2700;
    right: 16px;
    bottom: 16px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 11px 13px;
    color: #ffffff;
    background: rgba(22, 22, 22, 0.96);
    border: 1px solid rgba(39, 212, 90, 0.42);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
    font-size: 13px;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.sync-toast.is-open {
    opacity: 1;
    transform: translateY(0);
}

.sync-toast.is-error {
    border-color: rgba(255, 77, 77, 0.55);
}

.small-button {
    font-size: 11px;
}

@media (max-width: 640px) {
    .map-menu {
        top: 8px;
        left: 8px;
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: min(58vh, 520px);
        border-radius: 10px;
    }

    .map-menu.is-closed {
        width: 44px;
        height: 44px;
    }

    .map-menu-body {
        max-height: calc(min(58vh, 520px) - 52px);
    }

    .menu-category-header {
        grid-template-columns: 16px 24px minmax(0, 1fr) 44px 52px;
        padding-left: 10px;
        gap: 6px;
    }

    .menu-category-header.has-multiple-icons {
        grid-template-columns: 16px 58px minmax(0, 1fr) 44px 52px;
    }

    .menu-category-header.has-many-icons {
        grid-template-columns: 16px 54px minmax(0, 1fr) 44px 52px;
    }

    .menu-group-header {
        grid-template-columns: 16px minmax(0, 1fr);
    }

    .menu-group-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .menu-location-row {
        grid-template-columns: 28px 24px minmax(0, 1fr);
        padding: 7px 8px 7px 14px;
    }

    .menu-location-row > .small-button {
        grid-column: 3;
        width: 100%;
        min-width: 0;
    }

    .leaflet-top.leaflet-right {
        top: auto;
        right: 8px;
        bottom: 8px;
    }

    .popup {
        min-width: 230px;
    }

    .popup-image {
        width: 260px;
    }

    .image-viewer {
        padding: 12px;
    }

    .image-viewer-shell {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .image-viewer-frame {
        max-height: calc(100vh - 78px);
    }
}
