body {
    background: linear-gradient(135deg, #00db96 0%, #00c285 100%);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;       /* Dynamic viewport height for mobile */
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.not-found-page {
    color: #0b3f34;
    font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
    text-align: center;
}

.not-found {
    width: min(32rem, calc(100vw - 3rem));
    box-sizing: border-box;
    padding: clamp(2rem, 8vw, 4rem);
    border: 1px solid rgba(11, 63, 52, 0.18);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.18);
}

.not-found h1 {
    margin: 0;
    font-size: clamp(3.5rem, 15vw, 7rem);
    line-height: 1;
}

.not-found p {
    margin: 1rem 0 1.5rem;
    font-size: clamp(1rem, 4vw, 1.25rem);
}

.not-found a {
    color: #075d49;
    font-weight: 700;
}

#main-image {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 60vh;
    width: 95vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    filter: drop-shadow(0 -40px 60px rgba(0, 0, 0, 0.25));
}

#main-image img {
    max-width: 100%;
    max-height: 60vh;
    width: auto;
    height: auto;
    display: block;
}

#player {
    max-width: calc(100vw - 8px);
    width: auto;
    /* script.js will set inline width */
    top: 0;
    /* script.js will set inline top */
    position: fixed;
    visibility: hidden;  /* JS will show after positioning */

    /* Size tokens tied to viewport width so the player shrinks with the image */
    --player-height: clamp(2.4rem, 7vw, 4.0rem);
    --player-radius: 999px;

    --gap-sm: clamp(0.25rem, 1vw, 0.45rem);
    --gap-md: clamp(0.4rem, 1.5vw, 0.75rem);
    --gap-lg: clamp(0.6rem, 2vw, 1.1rem);

    --main-btn-size: calc(var(--player-height) * 1.512);
    --skip-btn-size: calc(var(--player-height) * 0.45);

    --track-height: clamp(0.25rem, 0.6vw, 0.4rem);
    --thumb-size: calc(var(--track-height) * 3);

    --title-font-size: clamp(0.9rem, 2.07vw, 1.26rem);
    --time-font-size: clamp(0.8rem, 1.8vw, 1.05rem);
}

#stl-player {
    background: transparent;
    color: #111;
    padding: var(--gap-md) var(--gap-lg);
    box-sizing: border-box;
    font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
    line-height: 1.3;
}

.player-top {
    display: flex;
    align-items: center;
    gap: calc(var(--gap-md) * 2);
    min-height: var(--player-height);
}

.player-btn {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.player-btn:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.player-btn-main {
    flex: 0 0 var(--main-btn-size);
    width: var(--main-btn-size);
    height: var(--main-btn-size);
    border-radius: calc(var(--player-height) * 0.22);
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #00db96;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

.player-btn-main .icon {
    width: calc(var(--player-height) * 0.864);
    height: calc(var(--player-height) * 0.864);
    fill: currentColor;
}

.player-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--gap-md);
}

.player-main-row {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    margin-bottom: var(--gap-sm);
}

.track-selector {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
}

.track-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: calc(var(--gap-md) * 0.5);
    padding: 0;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.track-dropdown-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.track-dropdown-btn:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.track-dropdown-btn #player-title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: var(--title-font-size);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-dropdown-btn .icon-chevron {
    flex: 0 0 auto;
    width: calc(var(--player-height) * 0.5);
    height: calc(var(--player-height) * 0.5);
    fill: currentColor;
    transition: transform 0.25s ease;
}

.track-dropdown-btn[aria-expanded="true"] .icon-chevron {
    transform: rotate(180deg);
}

.track-dropdown-menu {
    position: absolute;
    top: calc(100% + var(--gap-sm));
    left: 0;
    right: 0;
    background: #d4f3ea;
    border: 1px solid rgba(0, 219, 150, 0.25);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.track-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: calc(80vh - 100%);
}

.track-list {
    overflow-y: auto;
    max-height: calc(80vh - 100%);
    padding: var(--gap-sm) 0;
}

.track-item {
    padding: var(--gap-md) var(--gap-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: #111;
    font-size: var(--time-font-size);
    font-family: inherit;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-md);
}

.track-item:hover {
    background-color: rgba(0, 219, 150, 0.08);
}

.track-item.active {
    background-color: rgba(0, 219, 150, 0.15);
    font-weight: 600;
}

.track-item-number {
    flex: 0 0 auto;
    color: rgba(0, 0, 0, 0.5);
    min-width: 3ch;
}

.track-item-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-skip {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
}

.player-btn-skip {
    flex: 0 0 var(--skip-btn-size);
    width: var(--skip-btn-size);
    height: var(--skip-btn-size);
    border-radius: 10px;
    border: 1px solid #807b7b;
    background: transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.player-btn-skip .icon {
    width: calc(var(--skip-btn-size) * 0.6);
    height: calc(var(--skip-btn-size) * 0.6);
    fill: #000;
}

.player-timeline-row {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
}

.player-time-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--gap-sm);
}

.time {
    font-size: var(--time-font-size);
    min-width: 4ch;
    text-align: center;
    color: #111;
}

#current-time {
    text-align: left;
}

#duration {
    text-align: right;
}

.time-divider {
    font-size: var(--time-font-size);
    color: #111;
}

#seek-bar {
    flex: 1 1 auto;
    appearance: none;
    height: var(--track-height);
    border-radius: var(--player-radius);
    background: #c0c0c0;
    position: relative;
}

#seek-bar::-webkit-slider-runnable-track {
    height: var(--track-height);
    border-radius: var(--player-radius);
    background: #c0c0c0;
}

#seek-bar::-webkit-slider-thumb {
    appearance: none;
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 50%;
    background: #f2eeee;
    border: 1px solid #b2b2b2;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    margin-top: calc((var(--track-height) - var(--thumb-size)) / 2);
}

#seek-bar::-moz-range-thumb {
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 50%;
    background: #f2eeee;
    border: 1px solid #b2b2b2;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

#seek-bar::-moz-range-track {
    height: var(--track-height);
    border-radius: var(--player-radius);
    background: #c0c0c0;
}

/* Small-screen tweaks so things don’t get crushed */
@media (max-width: 600px) {
    .player-top {
        gap: var(--gap-md);
        min-height: var(--player-height);
    }

    .player-main-row {
        flex-wrap: wrap;
        row-gap: var(--gap-sm);
    }

    #player-title {
        white-space: normal;
    }
}

/* Fallback: show player after 2s if JS positioning fails */
@keyframes showPlayer { to { visibility: visible; } }
#player { animation: showPlayer 0s 2s forwards; }

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    #main-image {
        height: 75vh;
        /* bottom: 0 is inherited - image stays anchored to bottom */
    }
    #main-image img {
        max-height: 75vh;
    }
    #player {
        --player-height: clamp(2rem, 10vh, 3.2rem);
        --gap-sm: clamp(0.2rem, 1vh, 0.35rem);
        --gap-md: clamp(0.3rem, 1.5vh, 0.5rem);
        --gap-lg: clamp(0.4rem, 2vh, 0.8rem);
        --main-btn-size: calc(var(--player-height) * 1.4);
        --skip-btn-size: calc(var(--player-height) * 0.4);
        --track-height: clamp(0.2rem, 0.5vh, 0.3rem);
        --title-font-size: clamp(0.75rem, 2.5vh, 1rem);
        --time-font-size: clamp(0.65rem, 2vh, 0.85rem);
    }
    #stl-player {
        padding: var(--gap-sm) var(--gap-md);
    }
    .player-top {
        gap: var(--gap-md);
    }
}

/* Very short landscape (phones) */
@media (orientation: landscape) and (max-height: 400px) {
    #main-image {
        height: 80vh;
    }
    #main-image img {
        max-height: 80vh;
    }
    #player {
        --player-height: clamp(1.8rem, 12vh, 2.8rem);
        --main-btn-size: calc(var(--player-height) * 1.3);
        --title-font-size: clamp(0.7rem, 3vh, 0.9rem);
        --time-font-size: clamp(0.6rem, 2.5vh, 0.8rem);
    }
    .player-main-row {
        margin-bottom: 0;
    }
    .player-time-row {
        gap: 0.15rem;
    }
}
