:root {
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #14161a;
    color: #e6e8eb;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.page main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1c1f24;
    border-bottom: 1px solid #2a2e35;
    padding: 0.75rem 1.25rem;
}

.signout {
    background: none;
    border: 1px solid #2a2e35;
    border-radius: 6px;
    color: #9aa3ad;
    font: inherit;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
}

.signout:hover {
    border-color: #7ec8ff;
    color: #e6e8eb;
}

.login-card {
    max-width: 22rem;
    margin: 15vh auto 0;
    padding: 1.5rem;
    background: #1c1f24;
    border: 1px solid #2a2e35;
    border-radius: 8px;
}

.login-card h1 {
    margin-top: 0;
}

.login-card form {
    display: flex;
    gap: 0.5rem;
}

.login-card input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    background: #14161a;
    border: 1px solid #2a2e35;
    border-radius: 6px;
    color: inherit;
    font: inherit;
}

.login-card input:focus {
    outline: none;
    border-color: #7ec8ff;
}

.login-card button {
    padding: 0.55rem 1rem;
    background: #7ec8ff;
    border: none;
    border-radius: 6px;
    color: #14161a;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:disabled {
    opacity: 0.6;
    cursor: default;
}

.brand {
    color: #7ec8ff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.06em;
    text-decoration: none;
}

h1 {
    font-size: 1.4rem;
}

a {
    color: #7ec8ff;
}

.muted {
    color: #9aa3ad;
}

.error {
    color: #ff8a80;
}

.search {
    width: 100%;
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.75rem;
    background: #1c1f24;
    border: 1px solid #2a2e35;
    border-radius: 6px;
    color: inherit;
    font: inherit;
}

.search:focus {
    outline: none;
    border-color: #7ec8ff;
}

.library {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree {
    list-style: none;
    margin: 0;
    padding: 0 0 0 1.1rem;
}

.tree.root {
    padding-left: 0;
}

.folder-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.75rem;
    background: none;
    border: none;
    border-radius: 6px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.folder-toggle:hover {
    background: #22262d;
}

.chev {
    color: #7ec8ff;
    width: 1rem;
    flex: none;
}

.folder-name {
    overflow-wrap: anywhere;
    font-weight: 600;
}

.count {
    margin-left: auto;
    color: #9aa3ad;
    font-size: 0.8rem;
    background: #22262d;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    flex: none;
}

.library li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
}

.library li a:hover {
    background: #22262d;
}

.library .name {
    overflow-wrap: anywhere;
}

.library .meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #9aa3ad;
    font-size: 0.85rem;
    white-space: nowrap;
}

.badge {
    background: #2a2e35;
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cast-btn,
.cast-device,
.cast-controls button {
    background: #22262d;
    border: 1px solid #2a2e35;
    border-radius: 6px;
    color: inherit;
    font: inherit;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
}

.cast-btn:hover,
.cast-device:hover,
.cast-controls button:hover {
    border-color: #7ec8ff;
}

.cast-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    padding: 0.75rem;
    background: #1c1f24;
    border: 1px solid #2a2e35;
    border-radius: 6px;
}

.cast-panel {
    padding: 1rem;
    background: #1c1f24;
    border: 1px solid #2a2e35;
    border-radius: 6px;
}

.cast-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cast-controls input[type="range"] {
    flex: 1;
    min-width: 10rem;
    accent-color: #7ec8ff;
}

.cast-stop {
    color: #ff8a80;
}

.player-shell {
    position: relative;
}

.video-player {
    display: block;
    width: 100%;
    max-height: 78vh;
    background: #000;
    border-radius: 6px;
}

.player-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.player-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.overlay-label {
    color: #e6e8eb;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.spinner {
    width: 2.6rem;
    height: 2.6rem;
    border: 3px solid rgba(230, 232, 235, 0.25);
    border-top-color: #7ec8ff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.convert-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.convert-track {
    flex: 1;
    height: 4px;
    background: #2a2e35;
    border-radius: 999px;
    overflow: hidden;
}

.convert-bar {
    height: 100%;
    background: #7ec8ff;
    border-radius: 999px;
    transition: width 0.6s ease;
}

/* --- Blazor framework UI (loading spinner, error bar) --- */

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}

    .loading-progress circle {
        fill: none;
        stroke: #2a2e35;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #7ec8ff;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #14161a;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }
