body, html {
    margin: 0; padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
}
#optionsPanel {
    display: flex;
    overflow-x: auto;
    background: #1d1f24;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    flex-shrink: 0;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
#optionsPanel.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border: none;
}
.option {
    flex: 0 0 auto;
    width: 120px;
    margin-right: 10px;
    text-align: center;
    background: #0b3f4b;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}
.option img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: 3px;
    cursor: pointer;
    opacity: 1;
-webkit-transition: .15s ease-in-out;
transition: .15s ease-in-out;
    background: #1abc9c
}
.option img:hover {
opacity: .3;
}
.option button {
    background-color: #221033;
    border: none;
    color: white;
    padding: 4px 4px;
    font-size: 1em;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    margin: 2px 2px 2px 0;
    width: 100%;
}

/* When option has synoptic buttons, shrink all buttons */
.option.with-synoptic button {
    width: 48%;
    background-color: #221033;
}
.synoptic-btn {
    background-color: #550d57 !important;
}

.option.with-synoptic button:hover {
    background-color: #2b01bf;
}
.synoptic-btn:hover {
    background-color: #2b01bf !important;
}

#controls {
    background: #333;
    color: white;
    padding: 8px 10px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
#videosContainer {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20%, 1fr));
    gap: 10px;
    background: #222;
    padding: 10px;
    box-sizing: border-box;
    transition: height 0.3s ease;
    /* Initial height will be set dynamically */
    height: calc(100vh - 140px);
    overflow-y: auto;
}
video {
    width: 100%;
    background: black;
    border-radius: 6px;
    box-shadow: 0 0 10px #000;
    object-fit: contain;
    position: relative;
}
.video-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}
.remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(34, 16, 51, 0.8);
    border: none;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    line-height: 18px;
    padding: 0;
    transition: background-color 0.2s ease;
    z-index: 10;
}
.remove-btn:hover {
    background-color: #2b01bf;
}
.group-label {
    font-weight: bold;
    margin: 0 10px 0 0;
    align-self: center;
    white-space: nowrap;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.group-label a {
    color: #dddddd;
}
.group-label a:hover {
    color: #29c7ec;
}
.qr-code {
    margin-top: 4px;
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    filter: drop-shadow(0 0 1px black);
}
button {
    background-color: #221033;
    border: none;
    color: white;
    padding: 4px 10px;
    font-size: 1em;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}
button:hover {
    background-color: #2b01bf;
}
#toggleOptionsBtn {
    background-color: #444;
    padding: 6px 12px;
    font-size: 0.9em;
    border-radius: 4px;
}
#toggleOptionsBtn:hover {
    background-color: #222;
}

/* Overlay styles */
#imageOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}
#overlayContent {
    background: #111;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 15px #000;
}
#overlayContent img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 6px;
    margin-bottom: 15px;
    object-fit: contain;
}
#overlayContent .info-text {
    font-size: 1.1em;
    line-height: 1.4;
    text-align: center;
    white-space: pre-wrap;
}
#overlayCloseBtn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: #550d57;
    border: none;
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    z-index: 10000;
}
#overlayCloseBtn:hover {
    background-color: #2b01bf;
}
.single-video-fullheight {
    max-height: calc(100vh - 140px); /* Adjust 140px as sum of controls + options panel heights */
    width: auto !important;
    height: 100%;
    justify-self: center;
}
