.presura-layer-toolbar {
    position: fixed;
    top: calc(var(--presura-topbar-height, 60px) + 18px);
    right: clamp(12px, 1.25vw, 22px);
    z-index: var(--z-layer-toolbar, 1300);
    display: grid;
    grid-template-columns: repeat(2, minmax(56px, 64px));
    gap: 8px;
    width: max-content;
    max-height: calc(100dvh - var(--presura-topbar-height, 60px) - var(--presura-desktop-timeline-clearance, 92px) - 36px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;
    scrollbar-width: thin;
    overscroll-behavior: contain;
    pointer-events: auto;
}

.presura-layer-toolbar__button {
    min-width: 56px;
    min-height: 52px;
    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;
}

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-toolbar[data-layer-toolbar-surface="maps"] {
    position: static;
    display: flex;
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
}

.presura-layer-toolbar[data-layer-toolbar-surface="maps"] .presura-layer-toolbar__button {
    min-width: 52px;
    min-height: 44px;
    padding-block: 5px;
}

@media (max-width: 767px) {
    .presura-startbase__hud-rail {
        z-index: calc(var(--z-timeline, 1400) + 2);
    }

    .presura-layer-toolbar {
        top: auto;
        right: var(--presura-workspace-mobile-edge, 10px);
        bottom: calc(var(--presura-mobile-timeline-height, 92px) + env(safe-area-inset-bottom, 0px) + 12px);
        left: var(--presura-workspace-mobile-edge, 10px);
        z-index: calc(var(--z-timeline, 1400) + 2);
        grid-auto-flow: column;
        grid-template-columns: none;
        grid-auto-columns: minmax(58px, 64px);
        width: auto;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 0 4px;
        scrollbar-width: none;
    }

    .presura-layer-toolbar::-webkit-scrollbar {
        display: none;
    }

    .presura-layer-toolbar__button {
        min-height: 48px;
    }

    .presura-layer-toolbar[data-layer-toolbar-surface="maps"] {
        position: static;
        inset: auto;
        display: flex;
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
    }
}

@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;
    }
}
