:root {
    --btn-size: min(max(100vw, 100vh) / 20, 48px);
}

p {
    margin: auto;
    vertical-align: top;
    display: table-cell;
}

body {
    overflow: hidden;
    margin: 0;
    color: black;
    text-align: center;
    font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

a:visited,
a:link,
a:active {
    color: black;
}

a:hover {
    color: red;
}

table {
    border-spacing: 0;
}

td {
    padding: 0;
    border: none;
    text-align: center;
    background-color: bisque;
}

tr.headfoot {
    height: 5%;
    min-height: 5%;
    max-height: 5%;
}

td.photo {
    background-color: #777;
}

canvas.photo {
    padding: 0px;
    margin: 0;
    border: none;
}

#photo {
    display: block;
    width: 100%;
    height: 100%;
}

div.header {
    display: flex;
    flex-direction: row;
    flex-grow: 0;
    background-color: bisque;
    overflow-x: auto;
    overflow-y: hidden;
    grid-area: header;
    scrollbar-width: none;
}

div.header::-webkit-scrollbar {
    display: none;
}


div.gallery {
    position: relative;
    display: flex;
    overflow: hidden;
    grid-area: gallery;
}

#info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#info-box {
    border-radius: 14px;
    border: 2px solid white;
    overflow: hidden;
    min-width: 260px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#info-title {
    background: burlywood;
    padding: 12px 44px 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#info-filename {
    font-size: 1.2em;
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

#info-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1em;
    color: #555;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

#info-close:hover {
    color: #000;
}

#info-body {
    background: bisque;
    padding: 16px 20px 20px 20px;
}

#info-content p {
    display: block;
    margin: 0.5em 0;
    font-size: 1.3em;
    font-weight: normal;
    text-align: left;
    color: #222;
}

.logo-watermark {
    position: absolute;
    width: auto;
    height: auto;
    max-width: min(20vw, 20vh);
    max-height: min(20vw, 20vh);
    opacity: 0.15;
    mix-blend-mode: soft-light;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.4));
    pointer-events: none;
    z-index: 2;
}

#logo-bottom {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

#logo-left {
    left: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

#stream-progress {
    position: absolute;
    bottom: calc(var(--btn-size) + 28px);
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 400px;
    height: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
    display: none;
    transition: opacity 0.4s ease-out;
}

#stream-fill {
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.7);
    transition: width 0.15s ease-out;
}

#loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #777;
    gap: 1em;
    z-index: 1;
}

.loading-line {
    color: #eee;
    font-size: 5vw;
    font-weight: bold;
    letter-spacing: 0.02em;
}

@keyframes wave-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-14px); }
}

#loading span {
    display: inline-block;
    animation: wave-bounce 1.1s ease-in-out infinite;
}

#progress-track {
    width: 50vw;
    max-width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    transition: width 0.1s ease-out;
}

#progress-error {
    color: #faa;
    font-size: clamp(12px, 1.5vw, 18px);
    max-width: 50vw;
    text-align: center;
    padding: 0.5em 1em;
    display: none;
}

#button-bar {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 10;
}

.action-btn {
    width: var(--btn-size);
    height: var(--btn-size);
    background: transparent;
    border: 2px solid white;
    border-radius: 12px;
    color: white;
    opacity: 0.33;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--btn-size) * 0.5);
    cursor: pointer;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@keyframes btn-flash {
    0%   { opacity: 1.0; }
    100% { opacity: 0.33; }
}

@keyframes btn-flash-active {
    0%   { opacity: 1.0; }
    100% { opacity: 0.6; }
}

.action-btn.active {
    opacity: 0.6;
}

.action-btn.tapped {
    animation: btn-flash 0.35s ease-out forwards;
}

.action-btn.tapped-active {
    animation: btn-flash-active 0.35s ease-out forwards;
}

#btn-info {
    font-family: serif;
    font-style: normal;
    font-weight: bold;
}

#btn-about {
    position: fixed;
    bottom: 16px;
    left: 16px;
    font-family: serif;
    font-weight: bold;
    z-index: 10;
}

#about-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#about-box {
    border-radius: 14px;
    border: 2px solid white;
    overflow: hidden;
    min-width: 260px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#about-title {
    background: burlywood;
    padding: 12px 44px 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#about-heading {
    font-size: 1.2em;
    font-weight: 500;
    color: #333;
}

#about-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1em;
    color: #555;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

#about-close:hover {
    color: #000;
}

#about-body {
    background: bisque;
    padding: 16px 20px 20px 20px;
    max-height: 70vh;
    overflow-y: auto;
}

div.main-container {
    display: grid;
    grid-template-areas:
        "header"
        "gallery";
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 100%;
}

@media (orientation: landscape) {
    div.main-container {
        grid-template-areas:
            "header gallery";
        grid-template-rows: 1fr;
        grid-template-columns: auto 1fr;
    }

    div.header {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }
}