/* -----------------------------
   GLOBAL
----------------------------- */

body {
    margin: 0;
    overflow: hidden;
    background: #050816;
    color: #edf3fb;
    color-scheme: dark;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
    sans-serif;
}

#fps-counter {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 6;
    padding: 5px 8px;
    border: 1px solid #6f839c;
    border-radius: 6px;
    background: #101b2a;
    color: #edf3fb;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

canvas {
    display: block;
    cursor: grab;
}

body > canvas.three-scene-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
}

#valencia-port-map {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background: #050816;
}

.camera-water-effects {
    position: fixed;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
}

.camera-underwater-tint,
.camera-droplet-layer {
    position: absolute;
    inset: 0;
}

.camera-underwater-tint {
    opacity: 0;
    background:
        radial-gradient(
            circle at 50% 4%,
            rgba(126, 226, 235, 0.18),
            rgba(20, 111, 135, 0.1) 28%,
            transparent 58%
        ),
        linear-gradient(
            180deg,
            rgba(13, 104, 132, 0.28),
            rgba(0, 51, 76, 0.5)
        );
    box-shadow:
        inset 0 0 160px rgba(0, 29, 48, 0.58),
        inset 0 80px 120px rgba(85, 190, 205, 0.1);
    backdrop-filter: blur(0.8px) saturate(0.72) contrast(1.08);
    transition: opacity 180ms ease-out;
}

.camera-water-effects.is-underwater .camera-underwater-tint {
    opacity: 1;
}

.camera-droplet-layer {
    opacity: 0;
}

.camera-droplet-layer.is-active {
    opacity: 1;
}

.camera-water-droplet {
    --drop-x: 50%;
    --drop-y: 20%;
    --drop-width: 28px;
    --drop-height: 27px;
    --drop-radius: 7% 52% 55% 50%;
    --drop-rotation: 45deg;
    --drop-end-rotation: 45deg;
    --drop-highlight-x: 32%;
    --drop-highlight-y: 25%;
    --drop-delay: 0s;
    --drop-duration: 1.8s;
    --drop-travel: 45px;

    position: absolute;
    left: var(--drop-x);
    top: var(--drop-y);
    width: var(--drop-width);
    height: var(--drop-height);
    border: 0;
    border-radius: var(--drop-radius);
    background:
        radial-gradient(
            circle at var(--drop-highlight-x) var(--drop-highlight-y),
            rgba(255, 255, 255, 0.72) 0 5%,
            rgba(192, 235, 245, 0.2) 11%,
            rgba(28, 91, 112, 0.16) 50%,
            rgba(21, 82, 104, 0.1) 70%,
            transparent 76%
        );
    box-shadow:
        inset -4px -6px 8px rgba(6, 46, 68, 0.16),
        inset 3px 3px 5px rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(1.4px) saturate(1.2);
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) rotate(var(--drop-rotation));
    animation: cameraDropletEvaporate var(--drop-duration) ease-in var(--drop-delay) forwards;
}

@keyframes cameraDropletEvaporate {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -58%, 0) rotate(var(--drop-rotation)) scale(0.82);
    }

    9% {
        opacity: 0.82;
        transform: translate3d(-50%, -50%, 0) rotate(var(--drop-rotation)) scale(1);
    }

    68% {
        opacity: 0.58;
    }

    100% {
        opacity: 0;
        transform:
            translate3d(-50%, calc(-50% + var(--drop-travel)), 0)
            rotate(var(--drop-end-rotation))
            scale(0.84);
    }
}

canvas:active {
    cursor: grabbing;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;

    display: grid;
    place-items: center;

    color: #ebefff;
    background: #050816;

    opacity: 1;
    visibility: visible;

    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.loading-screen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-panel {
    display: grid;
    justify-items: center;
    gap: 14px;
}

.loading-eyebrow { font-size: 10px; letter-spacing: .22em; color: #82b9cc; }
.loading-title { font-size: clamp(25px, 4vw, 42px); letter-spacing: -.035em; font-weight: 550; }
.loading-caption { font-size: 12px; color: #96aabb; margin: 0 22px 12px; text-align: center; }
.port-view-controls { color: #edf3fb; padding: 8px 12px 14px; border-bottom: 1px solid #9bc3d125; margin-bottom: 6px; }
.port-control-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .13em; color: #a9c3d1; margin: 2px 0 10px; }
.port-quality-control select { min-height: 35px; border: 1px solid #a2c7d43d; border-radius: 8px; background: #1c2b3b; color: #edf3fb; font: inherit; font-size: 12px; cursor: pointer; padding: 8px; }
.port-quality-control select:focus-visible { outline: 2px solid #96d3e9; outline-offset: 2px; }
.port-quality-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12px; }
.port-quality-control select { color-scheme: dark; max-width: 155px; }
.port-quality-hint { font-size: 10px; color: #a9c3d1; line-height: 1.5; margin: 7px 0 0; }
body.light-theme { color: #172b3b; color-scheme: light; }
body.light-theme .port-view-controls { color: #172b3b; }
body.light-theme .port-quality-control select { background: #e7eff5; color: #172b3b; border-color: #8fa8ba; color-scheme: light; }
.port-quality-control select option { background: #1c2b3b; color: #edf3fb; }
body.light-theme .port-quality-control select option { background: #ffffff; color: #172b3b; }
body.light-theme .port-control-label, body.light-theme .port-quality-hint { color: #4b697b; }

.loading-bar {
    width: 130px;
    height: 3px;

    overflow: hidden;

    background: rgba(235, 239, 255, 0.16);
    border-radius: 999px;
}

.loading-bar-fill {
    width: 100%;
    height: 100%;

    background: #6fa8ff;
    border-radius: inherit;

    transform: scaleX(var(--loading-progress, 0));
    transform-origin: left center;
    transition: transform 0.48s cubic-bezier(0.2, 0.65, 0.35, 1);
}

@media (prefers-reduced-motion: reduce) {
    .loading-bar-fill,
    .loading-screen {
        transition: none;
    }
}

.icon-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;

    display: flex;
    align-items: flex-start;
    gap: 2px;

    padding: 4px;

    background: rgba(10, 14, 28, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;

    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}


.minimap {
position: fixed;
right: 20px;
bottom: 20px;
width: min(24vw, 150px);
height: min(24vw, 150px);
min-width: 50px;
min-height: 50px;
z-index: 35;
border: 0;
border-radius: 0;
overflow: hidden;
background: rgba(2, 7, 12, 0.86);
box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10);
backdrop-filter: blur(10px);
cursor: pointer;
user-select: none;
touch-action: none;
}

.minimap,
.minimap canvas {
    cursor: pointer;
}

.minimap canvas:active {
    cursor: pointer;
}

.minimap canvas {
display: block;
width: 100%;
height: 100%;
position: relative;
z-index: 0;
image-rendering: auto;
}

.minimap-label {
position: absolute;
left: 10px;
top: 8px;
pointer-events: none;
color: rgba(255, 255, 255, 0.86);
font-size: 10px;
font-weight: 800;
letter-spacing: 0.14em;
text-transform: uppercase;
text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}

.minimap-hover-area,
.minimap-camera-area {
position: absolute;
box-sizing: border-box;
pointer-events: none;
transform: translate(-50%, -50%);
}

.minimap-hover-area {
display: none;
z-index: 3;
width: 24px;
height: 24px;
color: rgba(255, 255, 255, 0.94);
filter:
    drop-shadow(0 0 3px rgba(2, 7, 12, 0.88))
    drop-shadow(0 2px 5px rgba(2, 7, 12, 0.72));
transition: none;
transform: translate(-33%, -8%);
}

.minimap-hover-area svg {
display: block;
width: 100%;
height: 100%;
}

.minimap-camera-area {
z-index: 2;
border: 1px solid rgba(125, 211, 252, 0.95);
background: rgba(125, 211, 252, 0.08);
box-shadow: 0 0 18px rgba(125, 211, 252, 0.22);
}

.minimap-marker-layer {
position: absolute;
inset: 0;
pointer-events: none;
z-index: 4;
}

.minimap-vessel-marker {
position: absolute;
left: 0;
top: 0;
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.68));
will-change: transform;
z-index: 1;
}

.minimap-vessel-marker.is-selected {
filter:
    drop-shadow(0 0 4px rgba(255, 255, 255, 0.68))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.72));
z-index: 2;
}

.minimap-vessel-svg {
display: block;
width: 100%;
height: 100%;
color: currentColor;
fill: currentColor;
stroke: currentColor;
overflow: visible;
}

body.light-theme .minimap {
background: rgba(255, 255, 255, 0.84);
box-shadow:
    0 12px 34px rgba(2, 7, 12, 0.16),
    inset 0 0 0 1px rgba(2, 7, 12, 0.12);
}

body.light-theme .minimap-label {
color: rgba(2, 7, 12, 0.78);
text-shadow: 0 1px 8px rgba(255, 255, 255, 0.9);
}

.minimap.is-hidden {
display: none;
}


.control-button-svg {
    display: block;
    width: 33px;
    height: 33px;
    pointer-events: none;

    transition: transform 0.18s ease;
}

.control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;
    padding: 0;
    
    color: #ebefff;
    background: transparent;

    border: 1px solid transparent;
    border-radius: 10px;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.control-button:hover {
    background: rgba(28, 39, 70, 0.92);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.control-button:hover .control-button-svg {
    transform: scale(1.11);
}


.control-button:active {
    transform: translateY(0);
}

.control-button:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 3px;
}

.control-button.is-off {
    color: rgba(235, 239, 255, 0.48);
    background: rgba(10, 14, 28, 0.62);
    border-color: rgba(255, 255, 255, 0.16);
}

.control-button.is-active {
    color: #ffffff;
    background: rgba(47, 91, 157, 0.88);
    border-color: rgba(111, 168, 255, 0.48);
}

.control-menu-wrapper {
    position: relative;
}

.search-menu-wrapper {
    position: relative;
}

.view-menu-wrapper {
    position: relative;
}

.controls-menu,
.search-menu,
.view-menu {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;

    min-width: 310px;
    padding: 6px;

    background: rgba(10, 14, 28, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;

    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.controls-menu.is-open,
.search-menu.is-open,
.view-menu.is-open {
    display: grid;
    gap: 4px;
}

.search-menu {
    position: fixed;
    top: 74px;
    left: 0;
    min-width: 0;
    padding: 8px;
    box-sizing: border-box;

    --search-imo-column-width: var(--search-imo-default-width, 72px);
    --search-name-column-width: var(--search-name-default-width, 120px);
    --search-company-column-width: var(--search-company-default-width, 112px);
    --search-type-column-width: var(--search-type-default-width, 92px);
    --search-visible-column-width: var(--search-visible-default-width, 116px);
    --search-trail-column-width: var(--search-trail-default-width, 112px);
    --search-label-column-width: var(--search-label-default-width, 120px);
    --search-color-column-width: var(--search-color-default-width, 64px);
    --search-list-columns: var(--search-imo-column-width) var(--search-name-column-width)
        var(--search-company-column-width) var(--search-type-column-width);
    --search-data-width: calc(var(--search-imo-column-width) + var(--search-name-column-width)
        + var(--search-company-column-width) + var(--search-type-column-width));
    --search-action-columns: var(--search-visible-column-width) var(--search-label-column-width)
        var(--search-trail-column-width) var(--search-color-column-width);
    --search-action-width: 0px;
    --search-table-width: calc(var(--search-data-width) + var(--search-action-width));
    --search-menu-width: calc(var(--search-table-width) + 28px);
}

.search-menu.has-search-actions {
    --search-action-width: calc(var(--search-visible-column-width) + var(--search-trail-column-width)
        + var(--search-label-column-width) + var(--search-color-column-width));
}

.search-menu.is-open {
    display: flex;
    flex-direction: column;
}

.controls-menu-header,
.search-menu-header,
.view-menu-header {
    display: grid;
    grid-template-columns: 1fr 30px;
    align-items: center;
    column-gap: 8px;

    min-height: 30px;
    padding: 0 2px 2px 10px;
}

.controls-menu-back,
.view-menu-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    grid-column: 1;
    grid-row: 1;

    width: 30px;
    height: 30px;
    margin-left: -8px;
    padding: 0;

    color: rgba(235, 239, 255, 0.78);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.controls-menu-back[aria-hidden="true"],
.view-menu-back[aria-hidden="true"] {
    visibility: hidden;
}

.controls-menu-back:hover,
.view-menu-back:hover {
    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(-1px);
}

.controls-menu-back:focus-visible,
.view-menu-back:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.controls-menu-back-icon,
.view-menu-back-icon {
    width: 20px;
    height: 20px;
}

.controls-menu-title,
.search-menu-title,
.view-menu-title {
    grid-column: 1;
    grid-row: 1;

    color: #ebefff;

    font-size: 13px;
    font-weight: 700;
    text-align: left;
}

.controls-menu:not(.is-subview) .controls-menu-title {
    margin-left: 0;
}

.controls-menu.is-subview .controls-menu-title {
    margin-left: 30px;
}

.view-menu:not(.is-subview) .view-menu-title {
    margin-left: 0;
}

.view-menu.is-subview .view-menu-title {
    margin-left: 30px;
}

.controls-menu-close,
.search-menu-close,
.view-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    grid-column: 2;

    width: 30px;
    height: 30px;
    padding: 0;

    color: rgba(235, 239, 255, 0.78);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.controls-menu-close:hover,
.search-menu-close:hover,
.view-menu-close:hover {
    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.controls-menu-close:focus-visible,
.search-menu-close:focus-visible,
.view-menu-close:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.controls-menu-close-icon,
.search-menu-close-icon,
.view-menu-close-icon {
    width: 22px;
    height: 22px;
}

.controls-menu-item {
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: center;
    gap: 10px;

    width: 100%;
    min-height: 42px;
    padding: 8px 10px;

    color: #ebefff;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

.controls-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.controls-menu-item:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.controls-menu-item.is-off {
    color: rgba(235, 239, 255, 0.48);
}

.controls-menu-item.is-active {
    color: #ffffff;
    background: rgba(47, 91, 157, 0.72);
    border-color: rgba(111, 168, 255, 0.42);
}

.depth-map-control {
    display: grid;
    gap: 2px;
}

.depth-map-control-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 4px;
}

.depth-map-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    padding: 0;

    color: rgba(235, 239, 255, 0.68);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    cursor: pointer;

    transition:
        color 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.depth-map-filter-button:hover,
.depth-map-filter-button.is-active {
    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.depth-map-filter-button.has-filter {
    color: #91b9ff;
}

.depth-map-filter-button:focus-visible,
.depth-map-filter-option:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.depth-map-filter-icon {
    width: 18px;
    height: 18px;
}

.depth-map-filter-panel {
    display: grid;
    gap: 2px;

    margin: 0 4px 4px 36px;
    padding: 4px;

    background: rgba(5, 10, 23, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.depth-map-filter-panel[hidden] {
    display: none;
}

.depth-map-filter-option {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;

    width: 100%;
    min-height: 34px;
    padding: 5px 7px;

    color: #ebefff;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;

    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: left;

    cursor: pointer;

    transition:
        color 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.depth-map-filter-option:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.08);
}

.depth-map-filter-option.is-off {
    color: rgba(235, 239, 255, 0.46);
}

.depth-map-filter-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 26px;
    height: 18px;
    box-sizing: border-box;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
}

.depth-map-filter-preview.is-color {
    clip-path: inset(0 1px 0 0 round 4px);

    background: linear-gradient(
        90deg,
        #d9483b 0%,
        #e8c64d 42%,
        #2f98cf 72%,
        #15327e 100%
    );
}

.depth-map-filter-preview.is-meters {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(19, 37, 65, 0.78);

    font-size: 8px;
    font-weight: 800;
    white-space: nowrap;
}

.depth-map-filter-state {
    min-width: 26px;

    color: rgba(235, 239, 255, 0.58);

    font-size: 10px;
    font-weight: 700;
    text-align: right;
}

.reset-menu-item {
    margin-top: 4px;

    color: rgba(235, 239, 255, 0.8);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.filter-category-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 4px;
}

.filter-category-button {
    grid-template-columns: 26px max-content auto;
    gap: 8px;
}

.filter-reset-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;
    padding: 0;

    color: rgba(235, 239, 255, 0.68);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

.filter-reset-button:hover {
    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.filter-reset-button:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.filter-reset-icon {
    width: 18px;
    height: 18px;
}

.theme-toggle {
    grid-template-columns: 26px minmax(0, 1fr) auto;
}

.theme-icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;
}

.theme-mode-label {
    min-width: 44px;
    padding: 3px 8px;

    color: rgba(235, 239, 255, 0.78);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.filter-category-count {
    color: rgba(235, 239, 255, 0.58);

    font-size: 12px;
    font-weight: 700;
}

.controls-menu-icon {
    width: 24px;
    height: 24px;
}

.settings-view {
    display: none;
}

.settings-view.is-active,
.view-menu-view.is-active {
    display: grid;
    gap: 4px;
}

.view-menu-view {
    display: none;
}

.advanced-view-page .port-view-controls {
    border: 0;
    margin: 0;
    padding: 0 6px 6px;
}

.advanced-view-page .port-quality-control {
    margin-top: 0;
}

.settings-empty-state {
    padding: 10px;

    color: rgba(235, 239, 255, 0.58);

    font-size: 12px;
    font-weight: 500;
}

.filter-panel {
    display: grid;
    gap: 10px;

    padding: 4px 2px 2px;
}

.filter-section {
    display: grid;
    gap: 4px;
}

.filter-section-title {
    padding: 2px 8px;

    color: rgba(235, 239, 255, 0.58);

    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.filter-options {
    display: grid;
    gap: 3px;
}

.filter-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;

    min-height: 32px;
    padding: 5px 8px;

    color: #ebefff;
    border-radius: 6px;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.filter-option input {
    width: 15px;
    height: 15px;
    margin: 0;

    accent-color: #6fa8ff;
}

.search-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

.trail-color-editor {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: rgba(111, 168, 255, 0.08);
    border: 1px solid rgba(111, 168, 255, 0.24);
    border-radius: 6px;
    font-size: 12px;
}

.trail-color-editor[hidden], .trail-color-control[hidden] { display: none; }

.trail-color-control {
    min-height: 34px;
    padding: 4px 8px;
    color: inherit;
    background: transparent;
    border: 1px solid rgba(111, 168, 255, 0.32);
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.trail-color-control:disabled { opacity: 0.5; cursor: default; }
#trail-color-input { width: 40px; height: 34px; cursor: pointer; }
.search-trail-color {
    justify-self: center;
    width: 36px;
    height: 34px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.search-trail-color::before {
    display: inline-block;
    width: 18px;
    height: 14px;
    background: var(--vessel-trail-color);
    border: 1px solid currentColor;
    border-radius: 4px;
    content: '';
}
.search-trail-color:hover, .trail-color-control:not(:disabled):hover { background: rgba(111, 168, 255, 0.14); }

.search-input-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 38px 9px 10px;

    color: #ebefff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;

    font: inherit;
    font-size: 13px;
    font-weight: 600;
}

.search-input::-webkit-search-cancel-button {
    display: none;
    -webkit-appearance: none;
}

.search-input::placeholder {
    color: rgba(235, 239, 255, 0.42);
}

.search-input:focus {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.search-input-clear {
    display: inline-flex;
    position: absolute;
    top: 50%;
    right: 6px;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    padding: 0;

    color: rgba(235, 239, 255, 0.78);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50%;

    cursor: pointer;

    transform: translateY(-50%);

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease;
}

.search-input-clear[hidden] {
    display: none;
}

.search-input-clear:hover {
    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.search-input-clear:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.search-input-clear-icon {
    width: 18px;
    height: 18px;
}

.search-options-panel {
    display: grid;
    gap: 4px;

    max-height: 0;
    overflow: hidden;
    padding-top: 0;

    opacity: 0;

    transform: translateY(-4px);
    transform-origin: top;

    transition:
        max-height 0.28s ease,
        opacity 0.2s ease,
        padding-top 0.28s ease,
        transform 0.24s ease;
}

.search-options-panel[hidden] {
    display: none;
}

.search-options-panel.is-open {
    max-height: 560px;
    padding-top: 2px;

    opacity: 1;

    transform: translateY(0);
}

.search-filter-panel {
    display: grid;
    gap: 5px;

    padding: 2px 0 6px;
}

.search-filter-panel[hidden] {
    display: none;
}

.search-filter-title {
    padding: 2px 4px 1px;

    color: rgba(235, 239, 255, 0.68);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.search-panel-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 4px;
    min-height: 0;
    overflow: hidden auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.search-panel-content > :not(.search-table-scroll) { flex-shrink: 0; }

.search-table-scroll {
    min-height: 68px;
    overflow: auto;
    flex: 1 1 auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 7px;
    background: rgba(5, 8, 22, 0.2);
    scrollbar-color: rgba(111, 168, 255, 0.65) rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

.search-table {
    width: var(--search-table-width);
    min-width: 100%;
}

.search-results { display: grid; }

.search-panel-edge {
    position: absolute;
    z-index: 4;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    touch-action: none;
}

.search-panel-edge[data-search-edge="left"],
.search-panel-edge[data-search-edge="right"] {
    top: 12px;
    bottom: 12px;
    width: 8px;
    cursor: ew-resize;
}

.search-panel-edge[data-search-edge$="left"] { left: 0; }
.search-panel-edge[data-search-edge$="right"] { right: 0; }

.search-panel-edge[data-search-edge="top"],
.search-panel-edge[data-search-edge="bottom"] {
    left: 12px;
    right: 12px;
    height: 8px;
    cursor: ns-resize;
}

.search-panel-edge[data-search-edge^="top"] { top: 0; }
.search-panel-edge[data-search-edge^="bottom"] { bottom: 0; }

.search-panel-edge[data-search-edge*="-"] {
    width: 12px;
    height: 12px;
}

.search-panel-edge[data-search-edge="top-right"],
.search-panel-edge[data-search-edge="bottom-left"] { cursor: nesw-resize; }

.search-panel-edge[data-search-edge="top-left"],
.search-panel-edge[data-search-edge="bottom-right"] { cursor: nwse-resize; }

.search-column-resize {
    position: absolute;
    z-index: 1;
    inset: 0 0 0 auto;
    display: grid;
    place-items: center;
    width: 14px;
    cursor: col-resize;
    touch-action: none;
}

.search-column-resize::before {
    content: '';
    width: 1px;
    height: 60%;
    background: currentColor;
    opacity: .38;
}

.search-column-resize:hover,
.search-column-resize:focus-visible,
.search-panel-edge:focus-visible {
    background-color: rgba(111, 168, 255, 0.2);
}

.search-column-resize:focus-visible,
.search-panel-edge:focus-visible,
.search-table-scroll:focus-visible {
    outline: 2px solid #6fa8ff;
    outline-offset: -2px;
}

.search-result-row.is-hidden-vessel .search-result-name,
.search-result-row.is-hidden-vessel .search-result-company,
.search-result-row.is-hidden-vessel .search-result-type,
.search-result-row.is-hidden-vessel .search-result-imo {
    color: rgba(235, 239, 255, 0.42);
}

body.light-theme .search-result-row.is-hidden-vessel .search-result-name,
body.light-theme .search-result-row.is-hidden-vessel .search-result-company,
body.light-theme .search-result-row.is-hidden-vessel .search-result-type,
body.light-theme .search-result-row.is-hidden-vessel .search-result-imo {
    color: rgba(17, 24, 39, 0.42);
}

.search-results-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: var(--search-data-width) var(--search-action-width);
    min-height: 34px;
    color: rgba(235, 239, 255, 0.76);
    background: #162535;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.search-results-header-content {
    display: grid;
    grid-template-columns: var(--search-list-columns);
    align-items: center;
    gap: 0;

    min-width: max-content;
}

.search-header-cell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;

    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    padding-right: 14px;

    border-right: 1px solid rgba(255, 255, 255, 0.055);
}

.search-header-cell:last-child {
    border-right: 0;
}

.search-header-cell-static {
    display: flex;
    align-items: center;
    padding: 0 14px 0 10px;
}

.search-header-cell[data-search-column="name"] { grid-template-columns: minmax(0, 1fr); }

.search-results-header-actions {
    display: none;
    grid-template-columns: var(--search-action-columns);
    align-items: stretch;
    min-width: 0;
}

.search-menu.has-search-actions .search-results-header-actions { display: grid; }
.search-action-column-labels { display: contents; }

.search-action-column-label {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    column-gap: 4px;

    min-width: 0;
    height: 100%;
    overflow: hidden;
    padding-right: 14px;

    border-right: 1px solid rgba(255, 255, 255, 0.055);
}

.search-action-column-label:last-child {
    border-right: 0;
}

.search-action-color { grid-template-columns: minmax(0, 1fr); }

.search-trail-color-heading {
    text-align: center;
}

.search-action-column-sort-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}

.search-action-column-sort-state-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    opacity: 0.8;
}

.search-action-column-sort,
.search-action-column-power {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    height: 100%;
    padding: 0;
    overflow: hidden;

    color: inherit;
    background: transparent;
    border: 0;

    font: inherit;
    cursor: pointer;

    transition: color 0.18s ease;
}

.search-action-column-sort {
    gap: 6px;
}

.search-action-column-sort {
    padding: 0 4px;

    font-size: inherit;
    font-weight: inherit;
    line-height: 1;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
}

.search-action-column-power {
    padding-right: 8px;
}

.search-action-column-sort:hover,
.search-action-column-sort.is-active,
.search-action-column-power:hover {
    color: #ebefff;
}

.search-action-column-sort:focus-visible,
.search-action-column-power:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: -2px;
}

.search-action-column-power-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.search-action-columns-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 8px;
    color: inherit;
    background: transparent;
    border: 1px solid rgba(111, 168, 255, .32);
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.search-action-columns-toggle[aria-expanded="false"] .search-filters-less,
.search-action-columns-toggle[aria-expanded="true"] .search-filters-more {
    display: none;
}

.search-action-columns-toggle:hover,
.search-action-columns-toggle.is-active {
    color: #ebefff;
    background: rgba(111, 168, 255, 0.14);
    border-color: rgba(111, 168, 255, 0.28);
}

.search-action-columns-toggle:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.search-header-sort {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;

    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    padding: 0 8px 0 10px;
    overflow: hidden;

    color: #ebefff;
    background: transparent;
    border: 0;

    font: inherit;
    text-transform: inherit;

    cursor: pointer;

    transition:
        color 0.18s ease,
        opacity 0.18s ease;
}

.search-header-sort:hover,
.search-header-sort.is-active,
.search-header-filter-button:hover,
.search-header-filter-button.is-active {
    color: #ebefff;
}

.search-header-sort:focus-visible,
.search-header-filter-button:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: -2px;
}

.search-header-sort span:first-child {
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-header-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    min-width: 34px;
    height: 100%;
    box-sizing: border-box;
    padding: 0;

    color: #ebefff;
    background: transparent;
    border: 0;

    cursor: pointer;

    transition: color 0.18s ease;
}

.search-header-sort-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;

    color: rgba(235, 239, 255, 0.48);
    opacity: 0.62;
}

.search-header-sort.is-active .search-header-sort-icon {
    color: rgba(255, 255, 255, 0.96);
    opacity: 1;
}

.search-header-sort-icon-desc,
.search-header-sort[data-sort-direction="desc"] .search-header-sort-icon-asc {
    display: none;
}

.search-header-sort[data-sort-direction="desc"] .search-header-sort-icon-desc {
    display: block;
}

.search-header-filter-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;

    opacity: 0.78;
}

.search-table-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.search-table-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.search-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(111, 168, 255, 0.58);
    border: 2px solid rgba(10, 14, 28, 0.92);
    border-radius: 999px;
}

.search-table-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(111, 168, 255, 0.82);
}

.search-result-row {
    display: grid;
    gap: 0;

    width: 100%;
    box-sizing: border-box;
    min-width: 0;

    color: #ebefff;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 0;

    transition:
        background 0.18s ease,
        opacity 0.18s ease;
}

.search-result-row:last-child {
    border-bottom: 0;
}

.search-result-main-row {
    position: relative;

    display: grid;
    grid-template-columns: var(--search-data-width) var(--search-action-width);
    align-items: center;
    gap: 0;
    min-height: 42px;
}

.search-result-row.is-hidden-vessel {
    color: #ebefff;
    opacity: 1;
}

.search-result-row:hover {
    background: rgba(111, 168, 255, 0.075);
    opacity: 1;
}

.search-result-item {
    display: block;

    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 42px;
    padding: 0;

    color: inherit;
    background: transparent;
    border: 0;

    font: inherit;
    text-align: left;

    cursor: pointer;
}

.search-result-content {
    display: grid;
    grid-template-columns: var(--search-list-columns);
    align-items: center;
    gap: 0;

    min-width: max-content;
}

.search-result-content > span {
    min-height: 42px;
    box-sizing: border-box;
    padding: 0 8px 0 10px;

    display: flex;
    align-items: center;

    border-right: 1px solid rgba(255, 255, 255, 0.055);

    text-align: left;
}

.search-result-content > span:last-child {
    border-right: 0;
}

.search-result-item:focus-visible,
.search-result-option-button:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 2px;
}

.search-result-toggle-icon {
    width: 18px;
    height: 18px;
}

.search-result-inline-options {
    display: none;
    grid-template-columns: var(--search-action-columns);
    align-items: center;
    justify-content: start;

    min-width: 0;
    height: 100%;

    overflow: hidden;


}

.search-menu.has-search-actions .search-result-inline-options {
    display: grid;
}

.search-result-option-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 0;

    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;

    font: inherit;
    font-size: 11px;
    font-weight: 700;
    text-align: left;

    cursor: pointer;
}

.search-result-option-button.is-off {
    color: rgba(235, 239, 255, 0.42);
}

.search-result-row.is-hidden-vessel .search-result-option-button {
    color: rgba(235, 239, 255, 0.44);
    opacity: 0.62;
}

.search-result-option-button:hover {
    background: rgba(111, 168, 255, 0.095);
    opacity: 1;
}

.search-result-option-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-name {
    font-size: 12px;
    font-weight: 700;
}

.search-result-name,
.search-result-company,
.search-result-type,
.search-result-imo {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-company,
.search-result-type,
.search-result-imo,
.search-empty {
    color: #ebefff;

    font-size: 12px;
    font-weight: 600;
}

.search-empty {
    padding: 14px;
}

.controls-help-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: start;
    gap: 12px;

    min-height: 34px;
    padding: 7px 10px;

    color: rgba(235, 239, 255, 0.78);

    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}

.controls-help-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.controls-help-combo {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;

    width: 70px;
}

.control-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 22px;
    height: 20px;
    padding: 0 5px;

    color: #ebefff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 5px;

    font-size: 10px;
    font-weight: 700;
}

#datetime-widget {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;

    width: fit-content;

    padding: 6px 8px;

    color: #f5f7ff;
    background: rgba(10, 14, 28, 0.88);

    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;

    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.map-label-guides {
    position: fixed;
    inset: 0;
    z-index: 7;
    pointer-events: none;
}

.map-label-leader,
.map-label-marker {
    position: absolute;
    top: 0;
    left: 0;
}

.map-label-leader {
    width: 1px;
    height: 1px;
    background: #c8e6f0c9;
    transform-origin: 0 50%;
}

.map-label-marker {
    width: 5px;
    height: 5px;
    border: 1px solid #0e2b3f;
    border-radius: 50%;
    background: #c8e6f0;
}

.port-label {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 8;
    cursor: pointer;
    user-select: none;
    font-family: inherit;
    padding: 4px 7px;
    border: 1px solid #91bdc9;
    border-radius: 4px;
    background: #102c39ee;
    color: #e9f7fb;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

/* -----------------------------
   COMPASS
----------------------------- */

.compass-widget {
    position: absolute;
    right: 185px;
    bottom: 20px;
    z-index: 10;

    display: grid;
    justify-items: center;
    gap: 6px;

    pointer-events: none;
}

body.is-minimap-hidden .compass-widget {
    right: 20px;
}

.compass-widget.is-hidden {
    display: none;
}

.compass-ring {
    position: relative;

    width: 60px;
    height: 60px;

    color: #ebefff;
    background: rgba(10, 14, 28, 0.78);
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;

    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.compass-ring::before {
    content: "";
    position: absolute;
    inset: 3px;

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.compass-needle {
    position: absolute;
    inset: 19px 22px;

    display: flex;
    justify-content: center;

    color: #ff5f63;

    transform-origin: 50% 50%;
    transition: transform 0.08s linear;
}

.compass-needle-icon {
    width: 20px;
    height: 22px;

    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.32));
}

.compass-camera-marker {
    position: absolute;
    top: -1px;
    left: 50%;

    width: 0;
    height: 0;

    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    border-top: 8px solid #ebefff;

    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));

    transform: translateX(-50%);
}

.compass-cardinals {
    position: absolute;
    inset: 0;

    transform-origin: 50% 50%;
    transition: transform 0.08s linear;
}

.compass-cardinal {
    position: absolute;

    top: 2px;
    left: 50%;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;

    color: #ffffff;

    font: inherit;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;

    transform: translateX(-50%);
}

.compass-cardinal:hover,
.compass-cardinal:focus-visible {
    background: #6fa8ff38;
}

.compass-cardinal:focus-visible {
    outline: 2px solid #6fa8ff;
    outline-offset: -2px;
}

.compass-cardinal-e {
    top: 50%;
    right: 2px;
    left: auto;

    transform: translateY(-50%);
}

.compass-cardinal-s {
    top: auto;
    bottom: 2px;
}

.compass-cardinal-w {
    top: 50%;
    left: 2px;

    transform: translateY(-50%);
}

.compass-degrees {
    min-width: 48px;
    padding: 4px 8px;

    color: #ebefff;
    background: rgba(10, 14, 28, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;

    font-size: 12px;
    font-weight: 700;
    text-align: center;

    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

/* -----------------------------
   VESSEL HOVER
----------------------------- */

#vessel-hover-label {
    display: none;
    position: fixed;
    z-index: 1000;
    pointer-events: none;

    padding: 6px 10px;

    color: white;
    background: rgba(10, 14, 28, 0.9);

    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;

    font-size: 12px;
    font-weight: 600;

    transform: translate(12px, 12px);
}

.vessel-name-label {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9;
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;

    padding: 4px 8px;

    color: #ebefff;
    background: rgba(10, 14, 28, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

}

.vessel-name-label.is-selected {
    z-index: 11;
}

/* -----------------------------
   BOAT INFO PANEL
----------------------------- */

#boat-info-panel {
    display: none;

    position: absolute;
    top: 24px;
    right: 24px;

    width: min(fit-content, calc(100vw - 48px));
    box-sizing: border-box;

    padding: 16px;

    background: rgba(10, 14, 28, 0.92);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-radius: 14px;

    color: #f5f7ff;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.03);

    z-index: 100;

    animation: fadeIn 0.25s ease;
}

#boat-info-panel.is-visible {
    display: block;
}

/* -----------------------------
   HEADER
----------------------------- */

.boat-header {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;

    transition: margin-bottom 0.28s ease;
}

.boat-card-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;

    color: #f5f7ff;
    background: rgba(255, 255, 255, 0.06);

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.boat-card-close-icon {
    width: 18px;
    height: 18px;

    transition: transform 0.22s ease;
}

.boat-card-close:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.boat-card-close:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 3px;
}

#boat-info-panel.is-collapsed .boat-header {
    margin-bottom: 0;
}

.boat-card-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;

    color: #f5f7ff;
    background: rgba(255, 255, 255, 0.06);

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.boat-card-toggle-icon {
    width: 18px;
    height: 18px;

    transition: transform 0.22s ease;
}

#boat-info-panel.is-collapsed .boat-card-toggle-icon {
    transform: rotate(180deg);
}

.boat-card-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.boat-card-toggle:active {
    transform: translateY(0);
}

.boat-card-toggle:focus-visible {
    outline: 2px solid rgba(111, 168, 255, 0.9);
    outline-offset: 3px;
}

.boat-card-body {
    width: 100%;
}

#boat-info-panel.is-collapsed .boat-card-body {
    display: none;
}

.boat-flag {
    flex: 0 0 auto;

    width: 58px;
    height: auto;

    object-fit: cover;

    border: 1px solid rgba(255, 255, 255, 0.12);
}

.boat-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.boat-title h2 {
    margin: 0;

    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.4px;

    color: white;

    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.boat-subtitle {
    margin-top: 2px;

    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);

    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

/* -----------------------------
   SECTIONS
----------------------------- */

.boat-section {
    margin-top: 12px;
}

.boat-section-title {
    margin-bottom: 8px;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 1px;

    color: #6fa8ff;
}

/* -----------------------------
   INFO ROWS
----------------------------- */

.boat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    column-gap: 12px;
    align-items: center;

    padding: 6px 0;

    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.boat-row > * {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.boat-row:last-child {
    border-bottom: none;
}

.boat-label {
    color: rgba(255, 255, 255, 0.58);

    font-size: 12px;
}

.boat-value {
    color: white;

    font-size: 12px;
    font-weight: 500;

    justify-self: end;
    text-align: right;
}

/* -----------------------------
   STATUS BADGE
----------------------------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 4px 9px;

    border-radius: 999px;

    background: rgba(42, 193, 121, 0.18);

    color: #57e389;

    font-size: 11px;
    font-weight: 600;
}

/* -----------------------------
   ANIMATION
----------------------------- */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------
   LIGHT THEME
----------------------------- */

body.light-theme {
    color-scheme: light;
    background: #f6f8fc;
}

body.light-theme .loading-screen {
    color: #111827;
    background: #f6f8fc;
}

body.light-theme .loading-bar {
    background: rgba(17, 24, 39, 0.12);
}

body.light-theme .loading-bar-fill {
    background: #2563eb;
}

body.light-theme .control-button,
body.light-theme .icon-container,
body.light-theme .controls-menu,
body.light-theme .search-menu,
body.light-theme .view-menu,
body.light-theme #datetime-widget,
body.light-theme .compass-ring,
body.light-theme .compass-degrees,
body.light-theme #vessel-hover-label,
body.light-theme .vessel-name-label,
body.light-theme #boat-info-panel {
    color: #111827;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(17, 24, 39, 0.12);
    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.light-theme .controls-menu,
body.light-theme .search-menu,
body.light-theme .view-menu,
body.light-theme #boat-info-panel {
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.94),
            rgba(248, 250, 252, 0.9)
        );
}

body.light-theme .control-button {
    background: transparent;
    box-shadow: none;
}

body.light-theme .control-button:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.28);
}

body.light-theme .control-button.is-off,
body.light-theme .controls-menu-item.is-off {
    color: rgba(17, 24, 39, 0.4);
}

body.light-theme .control-button.is-active,
body.light-theme .controls-menu-item.is-active {
    color: #ffffff;
    background: #2563eb;
    border-color: rgba(37, 99, 235, 0.42);
}

body.light-theme .controls-menu-title,
body.light-theme .search-menu-title,
body.light-theme .view-menu-title,
body.light-theme .controls-menu-item,
body.light-theme .reset-menu-item,
body.light-theme .filter-option,
body.light-theme .search-input,
body.light-theme .search-result-row,
body.light-theme .boat-title h2,
body.light-theme .boat-value,
body.light-theme .boat-card-close,
body.light-theme .boat-card-toggle,
body.light-theme .compass-cardinal {
    color: #111827;
}

body.light-theme .controls-menu-back,
body.light-theme .view-menu-back,
body.light-theme .controls-menu-close,
body.light-theme .search-menu-close,
body.light-theme .view-menu-close,
body.light-theme .search-input-clear {
    color: rgba(17, 24, 39, 0.68);
}

body.light-theme .controls-menu-back:hover,
body.light-theme .view-menu-back:hover,
body.light-theme .controls-menu-close:hover,
body.light-theme .search-menu-close:hover,
body.light-theme .view-menu-close:hover,
body.light-theme .controls-menu-item:hover,
body.light-theme .filter-option:hover,
body.light-theme .search-result-row:hover,
body.light-theme .search-input-clear:hover,
body.light-theme .search-result-option-button:hover,
body.light-theme .boat-card-close:hover,
body.light-theme .boat-card-toggle:hover {
    color: #111827;
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.16);
}

body.light-theme .filter-category-count,
body.light-theme .filter-section-title,
body.light-theme .search-filter-title,
body.light-theme .settings-empty-state,
body.light-theme .search-results-header,
body.light-theme .search-result-company,
body.light-theme .search-result-type,
body.light-theme .search-result-imo,
body.light-theme .search-empty,
body.light-theme .boat-subtitle,
body.light-theme .boat-label {
    color: rgba(17, 24, 39, 0.56);
}

body.light-theme .controls-help-row {
    color: rgba(17, 24, 39, 0.72);
}

body.light-theme .control-key,
body.light-theme .theme-mode-label,
body.light-theme .boat-card-close,
body.light-theme .boat-card-toggle {
    color: rgba(17, 24, 39, 0.72);
    background: rgba(37, 99, 235, 0.07);
    border-color: rgba(37, 99, 235, 0.14);
}

body.light-theme .reset-menu-item {
    border-top-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-input {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(17, 24, 39, 0.13);
}

body.light-theme .filter-reset-button {
    color: rgba(17, 24, 39, 0.62);
}

body.light-theme .filter-reset-button:hover,
body.light-theme .depth-map-filter-button:hover,
body.light-theme .depth-map-filter-button.is-active,
body.light-theme .search-action-columns-toggle:hover,
body.light-theme .search-action-columns-toggle.is-active {
    color: #111827;
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.16);
}

body.light-theme .depth-map-filter-button {
    color: rgba(17, 24, 39, 0.62);
}

body.light-theme .depth-map-filter-button.has-filter {
    color: #2563eb;
}

body.light-theme .depth-map-filter-panel {
    background: rgba(37, 99, 235, 0.035);
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .depth-map-filter-option {
    color: #111827;
}

body.light-theme .depth-map-filter-option:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.12);
}

body.light-theme .depth-map-filter-option.is-off {
    color: rgba(17, 24, 39, 0.4);
}

body.light-theme .depth-map-filter-state {
    color: rgba(17, 24, 39, 0.56);
}

body.light-theme .search-results-header {
    background: #e7eff5;
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-table-scroll {
    background: rgba(255, 255, 255, 0.44);
    border-color: rgba(17, 24, 39, 0.08);
    scrollbar-color: rgba(37, 99, 235, 0.48) rgba(17, 24, 39, 0.08);
}

body.light-theme .search-result-row {
    border-bottom-color: rgba(17, 24, 39, 0.07);
}

body.light-theme .search-header-sort:hover,
body.light-theme .search-header-sort.is-active,
body.light-theme .search-header-filter-button:hover,
body.light-theme .search-header-filter-button.is-active {
    color: #111827;
}

body.light-theme .search-header-sort,
body.light-theme .search-header-filter-button {
    color: #111827;
}

body.light-theme .search-header-sort-icon {
    color: rgba(17, 24, 39, 0.42);
}

.search-header-cell {
    border-right: 1px solid rgba(255, 255, 255, 0.055);
}

body.light-theme .search-results-header-actions {
    border-left-color: rgba(17, 24, 39, 0.075);
}

body.light-theme .search-result-content > span {
    border-right-color: rgba(17, 24, 39, 0.06);
}

body.light-theme .search-input::placeholder {
    color: rgba(17, 24, 39, 0.42);
}

body.light-theme .search-table-scroll::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-table-scroll::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.46);
    border-color: rgba(255, 255, 255, 0.9);
}

body.light-theme .search-result-row.is-hidden-vessel {
    color: #111827;
}

body.light-theme .search-result-option-button {
    background: transparent;
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-result-option-button.is-off {
    color: rgba(17, 24, 39, 0.4);
}

body.light-theme .search-result-row.is-hidden-vessel .search-result-option-button {
    color: rgba(17, 24, 39, 0.42);
}

body.light-theme .search-result-inline-options {
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-action-column-labels,
body.light-theme .search-action-column-label {
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .search-action-column-sort:hover,
body.light-theme .search-action-column-sort.is-active,
body.light-theme .search-action-column-power:hover {
    color: #111827;
}

body.light-theme .filter-option input {
    accent-color: #2563eb;
}

body.light-theme .compass-ring::before,
body.light-theme .boat-row {
    border-color: rgba(17, 24, 39, 0.08);
}

body.light-theme .compass-camera-marker {
    border-top-color: #111827;
}

body.light-theme .boat-section-title {
    color: #2563eb;
}

body.light-theme .status-badge {
    color: #157347;
    background: rgba(21, 115, 71, 0.12);
}

.depth-map-label {
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;

    color: rgba(255, 255, 255, 0.94);
    text-shadow:
        0 1px 2px rgba(2, 7, 12, 0.96),
        0 0 4px rgba(2, 7, 12, 0.82);

    font-family: Arial, sans-serif;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

/* Compact historical AIS controls; data notes open only on demand. */
#ais-playback {
    position: fixed; left: max(20px, env(safe-area-inset-left));
    bottom: max(44px, calc(env(safe-area-inset-bottom) + 44px));
    z-index: 36; width: min(260px, calc(100vw - 40px)); box-sizing: border-box;
    display: flex; flex-direction: column; padding: 8px; border-radius: 12px;
    color: #edf7fb; background: rgba(8, 22, 34, .94);
    border: 1px solid rgba(166, 211, 228, .3); box-shadow: 0 8px 30px #0004;
    backdrop-filter: blur(10px); font-size: 12px;
}
#ais-playback .ais-header { display: flex; align-items: center; gap: 8px; }
#ais-playback output { font: 600 14px/1.2 ui-monospace, monospace; color: #80dcec; white-space: nowrap; }
#ais-playback #ais-toggle { margin-left: 0; }
#ais-playback .ais-trail-settings { display: flex; margin-left: auto; }
#ais-playback #ais-trail-settings { display: flex; align-items: center; justify-content: center; gap: 4px; width: 64px; height: 34px; padding: 0 4px; }
#ais-playback #ais-trail-settings svg { width: 14px; height: 14px; }
#ais-playback #ais-trail-value { max-width: 34px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ais-playback.is-minimized .ais-trail-settings { display: none; }
#ais-playback #ais-trail-options[hidden] { display: none; }
#ais-playback .ais-trail-limit-label, #ais-playback .ais-trail-minutes-label { display: flex; align-items: center; gap: 8px; }
#ais-playback .ais-trail-limit-label { margin-bottom: 10px; }
#ais-playback #ais-trail-limit { accent-color: #80dcec; }
#ais-playback #ais-trail-minutes { width: 86px; box-sizing: border-box; padding: 6px; font: inherit; color: inherit; background: transparent; border: 1px solid #526a78; border-radius: 6px; }
#ais-playback.is-minimized { width: fit-content; }
#ais-playback.is-minimized #ais-toggle svg { transform: rotate(180deg); }
#ais-body { padding-top: 4px; }
#ais-body[hidden] { display: none; }
#ais-playback .ais-controls { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
#ais-playback button, #ais-playback select, #ais-playback summary {
    font: inherit; color: inherit; background: #183548;
    border: 1px solid #526a78; border-radius: 7px; cursor: pointer;
}
#ais-playback .ais-icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; box-sizing: border-box; flex-shrink: 0; }
#ais-playback svg { pointer-events: none; flex-shrink: 0; }
#ais-playback button:hover, #ais-playback summary:hover { background: #24485c; }
#ais-playback button[aria-pressed="true"] { color: #80dcec; background: #164458; border-color: #55a7b9; }
#ais-playback button:disabled, #ais-playback select:disabled { opacity: .5; cursor: default; }
#ais-playback :is(button, input, select, summary):focus-visible { outline: 2px solid #80dcec; outline-offset: 3px; }
#ais-timeline { display: block; width: 100%; min-height: 24px; margin: 0; accent-color: #80dcec; cursor: pointer; }
#ais-playback .ais-speed-control { display: flex; align-items: center; gap: 4px; margin-left: auto; }
#ais-playback select { min-height: 34px; padding: 4px; }
#ais-playback summary { list-style: none; }
#ais-playback summary::-webkit-details-marker { display: none; }
#ais-playback .ais-info-popover {
    position: absolute; bottom: calc(100% + 10px); left: 0; width: 100%; box-sizing: border-box;
    max-height: min(240px, calc(100dvh - 220px)); overflow-y: auto;
    padding: 12px; border-radius: 10px; background: #102737; border: 1px solid #526a78;
    box-shadow: 0 8px 30px #0004; font-size: 11px; line-height: 1.5;
}
#ais-playback .ais-info-popover p { margin: 0 0 8px; }
#ais-playback .ais-info-popover p:last-child { margin-bottom: 0; }
#ais-playback .has-error summary { color: #ffc47d; border-color: #ffc47d; }
body.light-theme #ais-playback, body.light-theme #ais-playback .ais-info-popover { background: rgba(245, 250, 253, .96); color: #17374a; }
body.light-theme #ais-playback :is(button, select, summary) { background: #e0edf4; }
body.light-theme #ais-playback output, body.light-theme #ais-playback button[aria-pressed="true"] { color: #006778; }
@media (max-width: 900px) {
    .minimap, .compass-widget { bottom: 90px; }

}
@media (max-width: 600px) {
    #ais-playback { left: max(12px, env(safe-area-inset-left)); width: min(260px, calc(100vw - 24px)); }
    #ais-playback .ais-icon-button { width: 40px; height: 40px; }
    #ais-playback select { min-height: 40px; }
    #ais-playback #ais-trail-settings { height: 40px; }
    .minimap, .compass-widget { bottom: auto; top: 88px; }
}

/* Avoid repeated full-scene blur compositing when GPU load is high. */
.render-low-power * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

/* Compact source credit for the optional city imagery. */
#city-map-credit {
    position: fixed; left: 20px; bottom: 8px; z-index: 35; padding: 3px 7px;
    border-radius: 5px; background: rgba(8,22,34,.75); color: #d9e8ef;
    font-size: 10px; line-height: 1.4;
}
#city-map-credit[hidden] { display: none; }
#city-map-credit a { color: inherit; text-decoration: none; }
#city-map-credit a:hover, #city-map-credit a:focus-visible { text-decoration: underline; color: #ffffff; }
body.light-theme #city-map-credit { color: #17374a; background: rgba(245,250,253,.9); }
body.light-theme #city-map-credit a:hover, body.light-theme #city-map-credit a:focus-visible { color: #006778; }

/* Only shown when the 3D port failed; the flat fallback is not a complete load. */
.port-load-status {
    position: fixed; z-index: 1500; top: 88px; left: 20px;
    display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 40px));
    box-sizing: border-box; padding: 12px 14px; border: 1px solid #c5a05f;
    border-radius: 12px; background: #172331; color: #fff1d6;
    font: 13px/1.5 Arial, sans-serif; box-shadow: 0 6px 24px #0005;
}
.port-load-status[hidden] { display: none; }
.port-load-status button {
    flex-shrink: 0; padding: 8px 10px; border: 1px solid #b7c8d4; border-radius: 7px;
    background: #29485d; color: #fff; font: inherit; cursor: pointer;
}
.port-load-status button:disabled { opacity: .65; cursor: wait; }
.port-load-status button:focus-visible { outline: 2px solid #83dfff; outline-offset: 3px; }

.city-context-status { display:flex; align-items:center; gap:8px; padding:8px 10px; color:#fff0ca; background:#253143; border-radius:8px; font:12px/1.4 Arial,sans-serif; }
.city-context-status[hidden] { display:none; }
.city-context-status button { flex-shrink:0; color:#fff; background:#36566d; border:1px solid #adc8da; border-radius:6px; padding:6px; cursor:pointer; }
.city-context-status button:focus-visible { outline:2px solid #83dfff; outline-offset:2px; }
.city-context-status button:disabled { opacity:.65; cursor:wait; }

/* Official quay navigation stays compact and usable on short viewports. */
.view-menu { max-height:calc(100dvh - 100px); overflow-y:auto; box-sizing:border-box; }
.port-location-search {
    width:100%; box-sizing:border-box; min-height:35px; border:1px solid #a2c7d43d;
    border-radius:8px; background:#1c2b3b; color:#edf3fb; font:inherit; font-size:12px; padding:8px;
}
.port-location-search { margin-bottom:8px; }
.port-location-search::placeholder { color:#b6c5d4; opacity:1; }
.port-location-list {
    max-height: max(80px, min(340px, calc(var(--ui-overlay-max-height, 480px) - 120px)));
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
}
.port-location-list button {
    display: block;
    width: 100%;
    min-height: 32px;
    padding: 6px 8px;
    border: 0;
    border-bottom: 1px solid #a2c7d426;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.port-location-list button:hover:not(:disabled) { background: #294052; }
.port-location-list button:focus-visible { outline: 2px solid #96d3e9; outline-offset: -2px; }
.port-location-list button:disabled { opacity: .65; cursor: wait; }
body.light-theme .port-location-list button { border-color: #8fa8ba65; }
body.light-theme .port-location-list button:hover:not(:disabled) { background: #d6e6f2; }
.port-location-empty[hidden] { display: none; }
.port-location-source { display:block; width:fit-content; margin:8px 0; color:#aed5e8; font:11px/1.4 Arial,sans-serif; }
.port-location-empty { color:inherit; font-size:12px; margin:8px 0; }
.port-location-search:focus-visible, .port-location-source:focus-visible { outline:2px solid #96d3e9; outline-offset:2px; }
body.light-theme .port-location-search { background:#e7eff5; color:#172b3b; border-color:#8fa8ba; color-scheme:light; }
body.light-theme .port-location-search::placeholder { color:#52677a; }
body.light-theme .port-location-source { color:#20576d; }

/* Separate navigation pages from the permanently accessible bottom playback dock. */
#ais-playback {
    left:50%; right:auto; transform:translateX(-50%);
    bottom:max(32px,calc(env(safe-area-inset-bottom) + 16px));
}
.controls-menu, .view-menu, .search-menu {
    position:fixed; z-index:40; top:var(--ui-overlay-top,88px); left:16px;
    width:min(330px,calc(100vw - 32px)); min-width:0;
    max-height:var(--ui-overlay-max-height,calc(100dvh - 250px));
    box-sizing:border-box; overflow-y:auto; overscroll-behavior:contain;
}
.search-menu {
    --search-panel-min-width: 300px;
    --search-panel-min-height: 168px;
    --search-panel-edge-margin: 8px;
    --search-panel-right-margin: 16px;
    --search-panel-bottom: max(var(--search-panel-edge-margin), calc(100dvh - var(--ui-dock-reserve, 162px)));
    --search-panel-x: clamp(var(--search-panel-edge-margin), var(--search-panel-left, 16px),
        calc(100vw - var(--search-panel-right-margin) - var(--search-panel-min-width)));
    --search-panel-y: clamp(var(--search-panel-edge-margin), var(--search-panel-top, var(--ui-overlay-top, 88px)),
        calc(var(--search-panel-bottom) - var(--search-panel-min-height)));
    --search-panel-available-height: calc(var(--search-panel-bottom) - var(--search-panel-y));
    left: var(--search-panel-x);
    top: var(--search-panel-y);
    width: min(max(var(--search-panel-min-width),
        var(--search-panel-width, var(--search-panel-content-max-width, var(--search-menu-width)))),
        calc(100vw - var(--search-panel-x) - var(--search-panel-right-margin)));
    height: var(--search-panel-height, auto);
    min-height: min(var(--search-panel-min-height), var(--search-panel-available-height));
    max-width: min(var(--search-panel-content-max-width, 100vw),
        calc(100vw - var(--search-panel-x) - var(--search-panel-right-margin)));
    max-height: min(var(--search-panel-content-max-height, var(--search-panel-available-height)),
        var(--search-panel-available-height));
    overflow: hidden;
}
#boat-info-panel {
    position:fixed; top:var(--ui-overlay-top,88px); right:16px;
    width:min(400px,calc(100vw - 32px)); max-height:var(--ui-boat-max-height,var(--ui-overlay-max-height,60dvh));
    overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain;
    scrollbar-width:thin; scrollbar-color:#64748b transparent;
}
body:has(.search-menu.is-open):has(#boat-info-panel.is-visible) {
    --paired-boat-width: clamp(260px, 32vw, 400px);
}
@media (min-width: 660px) {
    body:has(#boat-info-panel.is-visible) .search-menu.is-open {
        --search-panel-right-margin: calc(var(--paired-boat-width) + 28px);
    }
    body:has(.search-menu.is-open) #boat-info-panel.is-visible {
        width: var(--paired-boat-width);
    }
}
@media (width < 660px) {
    body:has(.search-menu.is-open):has(#boat-info-panel.is-visible) {
        --paired-panel-half-height: max(0px, calc(var(--ui-overlay-max-height, 60dvh) / 2 - 6px));
        --paired-panel-middle: calc(var(--ui-overlay-top, 88px) + var(--ui-overlay-max-height, 60dvh) / 2);
    }
    body:has(#boat-info-panel.is-visible) .search-menu.is-open {
        --search-panel-y: var(--ui-overlay-top, 88px);
        --search-panel-bottom: calc(var(--search-panel-y) + var(--paired-panel-half-height));
    }
    body:has(.search-menu.is-open) #boat-info-panel.is-visible {
        top: calc(var(--paired-panel-middle) + 6px);
        max-height: var(--paired-panel-half-height);
    }
}
#ais-playback .ais-info-popover { max-height:var(--ui-popover-max-height,240px); overscroll-behavior:contain; }
.view-menu-link { grid-template-columns:26px minmax(0,1fr) 16px; }
.view-menu-chevron { width:16px; height:16px; opacity:.75; }
.port-locations-view .port-view-controls { border:0; margin:0; padding-bottom:4px; }
.minimap, .compass-widget { position:fixed; top:auto; }
#vessel-hover-label { z-index:8; }
.vessel-name-label.is-selected { z-index:9; }
#frame-performance { bottom:calc(var(--ui-dock-reserve,160px) + 4px) !important; max-width:calc(100vw - 40px); overflow:auto; }
@media (max-width:900px) {
    body.has-open-ui-panel .minimap, body.has-open-ui-panel .compass-widget { visibility:hidden; pointer-events:none; }
}
