.presura-layer-picker {
    position: relative;
    display: block;
}

.presura-layer-picker[data-layer-picker-surface="workspace"] {
    position: fixed;
    top: calc(var(--presura-shell-topbar-bottom, var(--presura-topbar-height, 60px)) + 10px);
    left: calc(var(--presura-shell-sidebar-width, var(--presura-sidebar-collapsed, 64px)) + 16px);
    z-index: calc(var(--z-layer-toolbar, 1300) + 2);
    display: block;
    pointer-events: auto;
}

.presura-layer-picker__trigger {
    min-width: 146px;
    min-height: 42px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(8, 18, 25, 0.84);
    color: #edf5f3;
    box-shadow: 0 10px 24px rgba(2, 10, 14, 0.2);
    backdrop-filter: blur(14px) saturate(130%);
    -webkit-backdrop-filter: blur(14px) saturate(130%);
    text-align: left;
}

.presura-layer-picker__trigger:hover,
.presura-layer-picker__trigger:focus-visible {
    border-color: rgba(84, 185, 220, 0.44);
    background: rgba(12, 26, 34, 0.92);
    outline: none;
}

.presura-layer-picker__trigger-icon,
.presura-layer-picker__trigger-icon svg {
    width: 20px;
    height: 20px;
}

.presura-layer-picker__trigger-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.presura-layer-picker__trigger-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.presura-layer-picker__trigger-copy small {
    color: rgba(237, 245, 243, 0.62);
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.presura-layer-picker__trigger-copy strong {
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.presura-layer-picker__panel {
    position: fixed;
    top: calc(var(--presura-topbar-height, 60px) + 18px);
    left: clamp(12px, 1.25vw, 22px);
    right: auto;
    z-index: var(--z-layer-toolbar, 1300);
    width: min(332px, calc(100vw - 26px));
    max-height: calc(100dvh - var(--presura-topbar-height, 60px) - var(--presura-desktop-timeline-clearance, 92px) - 36px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: rgba(7, 18, 24, 0.94);
    color: #edf5f3;
    box-shadow: 0 20px 42px rgba(2, 10, 14, 0.34);
    backdrop-filter: blur(16px) saturate(135%);
    -webkit-backdrop-filter: blur(16px) saturate(135%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.985);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.presura-layer-picker[data-layer-picker-surface="workspace"] .presura-layer-picker__panel {
    top: calc(var(--presura-shell-topbar-bottom, var(--presura-topbar-height, 60px)) + 64px);
    left: calc(var(--presura-shell-sidebar-width, var(--presura-sidebar-collapsed, 64px)) + 16px);
    width: min(428px, calc(100vw - var(--presura-shell-sidebar-width, var(--presura-sidebar-collapsed, 64px)) - 32px));
    max-height: calc(100dvh - var(--presura-shell-topbar-bottom, var(--presura-topbar-height, 60px)) - var(--presura-desktop-timeline-clearance, 92px) - 78px);
}

.presura-layer-picker__panel[data-open="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.presura-layer-picker__handle {
    display: none;
}

.presura-layer-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.presura-layer-picker__header > div {
    display: grid;
    gap: 2px;
}

.presura-layer-picker__header small {
    color: rgba(237, 245, 243, 0.6);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.presura-layer-picker__header strong {
    font-size: 0.96rem;
}

.presura-layer-picker__close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font: inherit;
    font-size: 1.2rem;
}

.presura-layer-picker__backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-layer-toolbar, 1300) - 1);
    display: block;
    border: 0;
    background: rgba(2, 10, 14, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}

.presura-layer-picker.is-open .presura-layer-picker__backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.presura-layer-toolbar {
    position: static;
    z-index: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
    scrollbar-width: thin;
    overscroll-behavior: contain;
    pointer-events: auto;
}

.presura-layer-toolbar__button {
    min-width: 64px;
    min-height: 54px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    padding: 7px 5px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 14px;
    background: rgba(8, 18, 25, 0.9);
    color: #edf5f3;
    box-shadow: 0 10px 24px rgba(2, 10, 14, 0.2);
    backdrop-filter: blur(14px) saturate(130%);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

.presura-layer-toolbar__button:hover,
.presura-layer-toolbar__button:focus-visible {
    border-color: rgba(84, 185, 220, 0.5);
    background: rgba(15, 38, 43, 0.96);
    outline: none;
}

.presura-layer-toolbar__button.is-active,
.presura-layer-toolbar__button[aria-pressed="true"] {
    border-color: rgba(255, 180, 94, 0.7);
    background: linear-gradient(180deg, #ffad51, #ee812a);
    color: #fff;
}

.presura-layer-toolbar__icon,
.presura-layer-toolbar__icon svg {
    width: 18px;
    height: 18px;
}

.presura-layer-toolbar__icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.presura-layer-toolbar__label {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.58rem;
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: 0.02em;
    text-align: center;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.presura-layer-toolbar__more {
    position: relative;
}

.presura-layer-toolbar__more > summary {
    list-style: none;
}

.presura-layer-toolbar__more > summary::-webkit-details-marker {
    display: none;
}

.presura-layer-toolbar__button--more {
    cursor: pointer;
}

.presura-layer-toolbar__more-panel {
    position: absolute;
    top: 0;
    right: calc(100% + 10px);
    min-width: 220px;
    display: grid;
    grid-template-columns: repeat(2, minmax(88px, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    background: rgba(8, 18, 25, 0.94);
    box-shadow: 0 16px 32px rgba(2, 10, 14, 0.28);
    backdrop-filter: blur(16px) saturate(130%);
}

.presura-layer-toolbar__more:not([open]) .presura-layer-toolbar__more-panel {
    display: none;
}

.presura-layer-picker[data-layer-picker-surface="workspace"] .presura-layer-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.presura-layer-picker[data-layer-picker-surface="workspace"] .presura-layer-toolbar__button {
    min-height: 52px;
    padding: 7px 4px;
}

.presura-layer-picker[data-layer-picker-surface="workspace"] .presura-layer-toolbar__label {
    font-size: 0.54rem;
}

body[data-theme="light"] .presura-layer-toolbar__button {
    border-color: rgba(8, 35, 39, 0.14);
    background: rgba(255, 255, 255, 0.94);
    color: #143033;
}

body[data-theme="light"] .presura-layer-toolbar__button.is-active,
body[data-theme="light"] .presura-layer-toolbar__button[aria-pressed="true"] {
    color: #fff;
    background: linear-gradient(180deg, #ffad51, #ee812a);
}

.presura-layer-picker[data-layer-picker-surface="maps"] .presura-layer-picker__panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    left: auto;
}

.presura-layer-toolbar[data-layer-toolbar-surface="maps"] .presura-layer-toolbar__button {
    min-width: 0;
    min-height: 48px;
    padding-block: 6px;
}

@media (max-width: 767px) {
    .presura-startbase__hud-rail {
        z-index: calc(var(--z-timeline, 1400) + 2);
    }

    .presura-startbase__hud-rail.is-panel-open {
        z-index: calc(var(--presura-shell-z-drawer, 2700) + 1);
    }

    .presura-layer-picker__trigger {
        position: fixed;
        top: calc(var(--presura-shell-topbar-bottom, 72px) + 10px);
        left: var(--presura-workspace-mobile-edge, 10px);
        z-index: calc(var(--z-layer-toolbar, 1300) + 2);
        min-width: 124px;
        min-height: 44px;
        display: grid;
        grid-template-columns: 22px minmax(0, 1fr);
        align-items: center;
        gap: 9px;
        padding: 7px 11px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 14px;
        background: rgba(8, 18, 25, 0.88);
        color: #edf5f3;
        box-shadow: 0 10px 24px rgba(2, 10, 14, 0.22);
        backdrop-filter: blur(14px) saturate(130%);
        text-align: left;
    }

    .presura-layer-picker__panel {
        --presura-layer-picker-drag-y: 0px;
        position: fixed;
        left: var(--presura-workspace-mobile-edge, 10px);
        right: var(--presura-workspace-mobile-edge, 10px);
        bottom: calc(var(--presura-mobile-bottom-nav-height, 58px) + env(safe-area-inset-bottom, 0px) + 6px);
        z-index: var(--presura-shell-z-drawer, 2700);
        max-height: min(56dvh, 520px);
        display: grid;
        grid-template-rows: 22px auto minmax(0, 1fr);
        padding: 6px 12px 12px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 22px;
        background: rgba(5, 24, 23, 0.97);
        color: #edf5f3;
        box-shadow: 0 20px 44px rgba(0, 0, 0, 0.32);
        transform: translateY(calc(100% + 18px));
        visibility: hidden;
        transition: transform 0.22s ease, visibility 0.22s ease;
    }

    .presura-layer-picker__panel[data-open="true"] {
        transform: translateY(var(--presura-layer-picker-drag-y));
        visibility: visible;
    }

    .presura-layer-picker__panel.is-dragging {
        transition: none;
    }

    .presura-layer-picker__handle {
        display: grid;
        width: 100%;
        min-height: 22px;
        place-items: center;
        padding: 6px 0 5px;
        border: 0;
        background: transparent;
        cursor: grab;
        touch-action: none;
    }

    .presura-layer-picker__handle span {
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: rgba(237, 245, 243, 0.34);
    }

    .presura-layer-picker__backdrop {
        position: fixed;
        inset: 0;
        z-index: calc(var(--presura-shell-z-drawer, 2700) - 1);
        display: block;
        border: 0;
        background: rgba(1, 12, 13, 0.46);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    .presura-layer-picker.is-open .presura-layer-picker__backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .presura-layer-picker__close {
        width: 44px;
        height: 44px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 13px;
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
        font: inherit;
        font-size: 1.35rem;
    }

    .presura-layer-picker .presura-layer-toolbar {
        position: static;
        z-index: auto;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row;
        grid-auto-columns: auto;
        gap: 10px;
        width: 100%;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 0 2px 4px;
        scrollbar-width: thin;
    }

    .presura-layer-picker .presura-layer-toolbar__more {
        grid-column: 1 / -1;
    }

    .presura-layer-picker .presura-layer-toolbar__more-panel {
        position: static;
        right: auto;
        min-width: 0;
        margin-top: 8px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .presura-layer-toolbar::-webkit-scrollbar {
        display: none;
    }

    .presura-layer-picker .presura-layer-toolbar__button {
        min-width: 0;
        min-height: 56px;
        grid-template-columns: 22px minmax(0, 1fr);
        grid-template-rows: 1fr;
        justify-items: start;
        gap: 10px;
        padding: 10px 12px;
        text-align: left;
    }

    .presura-layer-picker .presura-layer-toolbar__button::after {
        content: none !important;
        display: none !important;
    }

    .presura-layer-picker .presura-layer-toolbar__button.is-active::after {
        content: none !important;
        display: none !important;
    }

    .presura-layer-picker .presura-layer-toolbar__label {
        font-size: 0.72rem;
        text-align: left;
    }

    .presura-layer-toolbar[data-layer-toolbar-surface="maps"] {
        position: static;
        inset: auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100%;
        max-height: none;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: 4px;
    }

    body.presura-mobile-layers-open .presura-startbase__legend-toggle {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px);
    }
}

@media (min-width: 768px) and (max-height: 720px) {
    .presura-layer-toolbar {
        grid-template-columns: repeat(3, minmax(52px, 58px));
    }

    .presura-layer-toolbar__button {
        min-width: 52px;
        min-height: 46px;
        padding-block: 5px;
    }
}

body[data-theme="light"] .presura-layer-picker__trigger {
    border-color: rgba(8, 35, 39, 0.14);
    background: rgba(255, 255, 255, 0.94);
    color: #143033;
}

body[data-theme="light"] .presura-layer-picker__panel {
    border-color: rgba(8, 35, 39, 0.12);
    background: rgba(255, 255, 255, 0.97);
    color: #143033;
}

body[data-theme="light"] .presura-layer-picker__header {
    border-bottom-color: rgba(8, 35, 39, 0.08);
}

body[data-theme="light"] .presura-layer-picker__header small,
body[data-theme="light"] .presura-layer-picker__trigger-copy small {
    color: rgba(20, 48, 51, 0.58);
}

body[data-theme="light"] .presura-layer-picker__close {
    border-color: rgba(8, 35, 39, 0.12);
    background: rgba(8, 35, 39, 0.04);
    color: #143033;
}
