@font-face {
    font-family: "Quintessential-Regular";
    src: url("../font/Quintessential-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Simple credit footer */
#cesium-credit {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: #aaa;
    padding: 4px 8px;
    font-size: 0.9rem;
    text-align: center;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
#cesium-credit a {
    color: #aaa;
    text-decoration: none;
}
#cesium-credit a:hover {
    text-decoration: underline;
}
#cesium-credit .cesium-credit-logoContainer {
    display: none;
}
/* Hide default Cesium credit widget */
.cesium-credit {
    display: none !important;
}

@media (max-width: 768px) {
    #cesium-credit {
        font-size: 0.6rem;
        padding: 2px 6px;
    }
    #cesium-credit img {
        height: 14px;
        width: auto;
    }
}
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
    color: white;
    background-color: black;
}
#cesiumContainer {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 30px;
}
/* Header styles */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(
        to bottom,
        rgba(184, 134, 11, 0.3),
        rgba(0, 0, 0, 0.95)
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(184, 134, 11, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    z-index: 1001;
    padding: 0 20px;
    box-sizing: border-box;
}
#main-header h1 {
    margin: 0;
    font-size: 2rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
#main-header p {
    margin: 0;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: right;
    max-width: 520px;
    font-weight: 800;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
/* Footer styles */
#main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    /*background: rgba(0, 0, 0, 0.7);*/
    background: linear-gradient(
        to bottom,
        rgba(184, 134, 11, 0.4),
        rgba(0, 0, 0, 0.95)
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(184, 134, 11, 0.3);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 0.7rem;
    z-index: 1001;
    box-sizing: border-box;
}
#cesium-credit {
    position: static;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 9px;
    color: rgba(255, 255, 255, 0.6);
}
#footer-text {
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
#side-panel {
    position: fixed;
    top: 60px;
    right: -330px;
    width: 300px;
    height: calc(100vh - 120px);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 20px;
    transition: right 0.4s ease;
    z-index: 10;
    overflow-y: auto;
    scroll-behavior: smooth;
}
/* Marker tooltip styling */

/* Marker tooltip styling */
/* Tooltip CSS removed - using Cesium labels instead */
#side-panel.open {
    right: 0;
}
/* Custom scrollbar styling for side panel */
#side-panel::-webkit-scrollbar {
    width: 6px;
}
#side-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
#side-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
#side-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
#side-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}
#panel-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
}
#panel-backdrop.visible {
    opacity: 1;
    visibility: visible;
}
#panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

#panel-title {
    margin: 0 0 16px 0;
    font-size: 1.2rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    line-height: 1.2;
    padding-bottom: 8px;
    border-bottom: 2px solid darkgoldenrod;
}
#panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    flex: 1;
    text-align: left;
    padding-right: 12px;
}
#close-panel {
    cursor: pointer;
    font-size: 0.8rem;
    font-family: "Quintessential-Regular", cursive;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    color: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    transition: all 0.2s;
}
#close-panel:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(360deg);
}
#legend {
    position: fixed;
    top: 60px;
    left: 0px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 16px;
    font-size: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 240px;
    max-width: 300px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* Custom scrollbar styling */
#legend::-webkit-scrollbar {
    width: 6px;
}
#legend::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
#legend::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
#legend::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
#legend {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}
/* Grain texture overlay */
#legend::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 6px;
    z-index: -1;
}
.legend-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.legend-section {
    padding-top: 0;
    margin-bottom: 8px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.section-header {
    font-size: 1rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: darkgoldenrod;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-header:first-child {
    border-top: none;
    padding-top: 0;
    margin-bottom: 4px;
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

#legend-image-container::after {
    content: "Reiver Globe Legend";
    position: absolute;
    top: 90%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.5rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    padding: 10px;
    border-radius: 6px;
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

#legend-image-container {
    position: relative;
    text-align: center;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid black;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}
#legend-image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
#legend-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 0;
}
#legend .legend-section:nth-child(3) div[data-type] {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    margin: 6px 0;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

#legend .legend-section:nth-child(3) div[data-type]:not(.inactive) {
    background: rgba(255, 255, 255, 0.15);
    border-color: darkgoldenrod;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
}

#legend .legend-section:nth-child(3) div[data-type]:focus {
    outline: 2px solid darkolivegreen;
    outline-offset: 2px;
}

#legend .legend-section:nth-child(3) div[data-type]:focus-visible {
    outline: 2px solid darkolivegreen;
    outline-offset: 2px;
}

#legend .legend-section:nth-child(3) div[data-type]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.marker-bastle,
.marker-tower,
.marker-pele {
    display: none;
}

.type-label {
    flex: 1;
    font-size: 1.2rem;
    font-family: "Quintessential-Regular", cursive;
    /*font-weight: 500;*/
}

.count-badge {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.3s ease;
}
.count-badge.filled {
    color: white;
}

#legend
    .legend-section:nth-child(3)
    div[data-type]:not(.inactive)
    .count-badge {
    /*background: currentColor;*/
    /*color: white;*/
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Layer switcher inside legend */
#layer-switcher {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px;
    gap: 4px;
}
.legend-action {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 3px;
    gap: 0;
    margin-top: 0px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.legend-action button {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    font-family: "Quintessential-Regular", cursive;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}
.legend-action button:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.legend-action button:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.legend-action button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}
.legend-action button.active {
    background: rgba(184, 134, 11, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.legend-action button:focus {
    outline: 2px solid darkolivegreen;
    outline-offset: 2px;
}
#layer-switcher div {
    text-align: center;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 1.2rem;
    transition: all 0.2s;
    font-family: "Quintessential-Regular", cursive;
}
#layer-switcher div:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
#layer-switcher div:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
#layer-switcher div.active {
    background: rgba(184, 134, 11, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}
#layer-switcher div:hover {
    background: rgba(255, 255, 255, 0.1);
}
/* Legend type markers */
.legend-marker {
    font-weight: bold;
}
.legend-marker-bastle {
    color: #e74c3c;
}
.legend-marker-tower {
    color: darkolivegreen;
}
.legend-marker-pele {
    color: #2ecc71;
}
/* Photo styling */
#panel-photo-container {
    margin-bottom: 16px;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
#panel-photo {
    max-width: 100%;
    max-height: 250px;
    height: auto;
    display: block;
    position: relative;
    z-index: 0;
    object-fit: cover;
}
#panel-photo-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 30%,
        rgba(0, 0, 0, 0.7) 100%
    );
    z-index: 1;
    pointer-events: none;
    border-radius: 6px;
}
#panel-photo-container::after {
    content: attr(data-site-name);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 6px 16px;
    border-radius: 20px;
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
}
/* Panel content typography */
#panel-type {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(184, 134, 11, 0.15);
    border: 1px solid darkgoldenrod;
    color: white;
    font-size: 0.85rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    border-radius: 12px;
    margin-bottom: 8px;
}
#panel-grade {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(184, 134, 11, 0.15);
    border: 1px solid darkgoldenrod;
    color: white;
    font-size: 0.85rem;
    font-family: "Quintessential-Regular", cursive;
    font-weight: 400;
    text-transform: uppercase;
    border-radius: 12px;
    margin-bottom: 8px;
}
#panel-desc {
    background: rgba(255, 255, 255, 0.06);
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.6;
    border-left: 3px solid darkolivegreen;
}
#panel-fact {
    background: rgba(184, 134, 11, 0.1);
    border-left: 3px solid darkgoldenrod;
    font-style: italic;
    margin-top: 10px;
    padding: 12px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 16px;
}
#panel-address,
#panel-postcode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 6px;
    margin-bottom: 6px;
}

#panel-address::before {
    content: "📍";
    font-size: 10px;
}

#panel-postcode::before {
    content: "✉";
    font-size: 10px;
}
#panel-what3words {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 12px;
    background: rgba(184, 134, 11, 0.1);
    border: 1px solid darkgoldenrod;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 1rem;
    font-family: "Quintessential-Regular", cursive;
    transition: all 0.2s;
}
#panel-what3words:hover {
    background: rgba(184, 134, 11, 0.2);
    border-color: rgba(184, 134, 11, 0.6);
    color: white;
}
.panel-actions {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 3px;
    gap: 0;
    margin-top: 12px;
}
.panel-action-btn {
    flex: 1;
    text-align: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    font-family: "Quintessential-Regular", cursive;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
    cursor: pointer;
}
.panel-action-btn:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.panel-action-btn:last-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.panel-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}
.panel-action-btn:focus {
    outline: 2px solid darkolivegreen;
    outline-offset: 2px;
}
.panel-action-btn.active {
    background: rgba(184, 134, 11, 0.5);
    border-color: darkgoldenrod;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Loading indicator */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}
#loading.hidden {
    opacity: 0;
    pointer-events: none;
}
.spinner {
    width: 80px;
    height: 80px;
    background: url("/images/IconColourRound.png") no-repeat center center;
    background-size: 80px 80px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation:
        spin 2s linear infinite,
        pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
#loading-text {
    margin-top: 20px;
    color: white;
    font-size: 16px;
    text-align: center;
    min-height: 24px;
}
#loading-text .loading-message {
    display: inline-block;
    animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* Search input inside legend */
#legend #search-container {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.search-input-wrapper {
    position: relative;
}
#search-input {
    width: 80%;
    padding: 10px 36px 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: all 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: darkolivegreen;
    box-shadow: 0 0 0 2px darkolivegreen;
    background: rgba(255, 255, 255, 0.12);
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
#clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#clear-search:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

#clear-search:disabled {
    opacity: 0;
    pointer-events: none;
}
/* Responsive design for mobile devices */
@media (max-width: 768px) {
    #main-header {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 4px;
    }
    #main-header h1 {
        text-align: center;
        max-width: none;
        font-size: 1.4rem;
    }
    #main-header p {
        text-align: center;
        max-width: none;
        font-size: 0.6rem;
    }

    #panel-header h2 {
        font-size: 1.1rem;
    }
    .panel-action-btn {
        padding: 14px 16px;
        font-size: 1rem;
    }
    #panel-header h2 {
        font-size: 1.1rem;
    }
    .panel-action-btn {
        padding: 14px 16px;
        font-size: 1rem;
    }

    #legend {
        display: flex;
        flex-direction: column;
        top: auto;
        bottom: 40px;
        /*left: 10px;*/
        right: 10px;
        max-width: none;
        max-height: 40vh;
        border-radius: 12px 12px 0 0;
    }

    #legend-image {
        max-width: 100%;
        max-height: 100%;
    }

    #legend #search-container {
        margin-bottom: 0;
        padding-bottom: 0;
    }
    #search-input {
        width: 100%;
        box-sizing: border-box;
    }
    #legend .legend-action {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    .legend-action {
        margin-bottom: 20px;
    }
    .legend-action button {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        background: transparent;
        border: none;
        border-radius: 6px;
        color: white;
        font-size: 1rem;
        cursor: pointer;
        transition: all 0.2s;
    }
    .legend-action button:first-child {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .legend-action button:last-child {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    .legend-action button:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    .legend-action button:focus {
        outline: 2px solid darkolivegreen;
        outline-offset: 2px;
    }
    #panel-header h2 {
        font-size: 18px;
    }
    #close-panel {
        font-size: 1rem;
    }
    #main-footer {
        justify-content: space-between;
        align-items: center;
        padding: 0 20px;
        font-size: 0.7rem;
        z-index: 1001;
    }
}

/* Loading spinner for panel photo */
#panel-photo-container::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#panel-photo-container.loaded::after {
    opacity: 0;
    pointer-events: none;
}

#panel-photo {
    opacity: 0;
    transition: opacity 0.5s ease;
}

#panel-photo-container.loaded #panel-photo {
    opacity: 1;
}
