:root {
    --bg: #000;
    --bg-overlay: rgba(0, 0, 0, 0.8);
    --bg-overlay-heavy: rgba(0, 0, 0, 0.9);
    --bg-surface: rgba(20, 20, 20, 0.95);
    --bg-button: #333;
    --bg-button-hover: #444;
    --text: #fff;
    --text-muted: #aaa;
    --text-dim: #888;
    --text-ghost: rgba(255, 255, 255, 0.7);
    --border: #333;
    --border-light: #555;
    --accent-drag: rgba(50, 100, 200, 0.9);
    --accent-priority: rgba(255, 200, 0, 0.8);
    --accent-error: #ff6b6b;
    --progress-bg: rgba(255, 255, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

@supports (height: 100dvh) {
    body {
        height: 100dvh;
    }
}

#drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-overlay-heavy);
    z-index: 1000;
    transition: opacity 0.3s;
}

#drop-zone.hidden {
    opacity: 0;
    pointer-events: none;
}

#drop-zone.drag-over {
    background: var(--accent-drag);
}

.drop-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.drop-text {
    font-size: 24px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.drop-hint {
    font-size: 14px;
    opacity: 0.5;
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
}

.format-note {
    margin-top: 20px;
    font-size: 12px;
    opacity: 0.4;
    max-width: 500px;
    text-align: center;
}

#browse-btn {
    margin-top: 20px;
    padding: 12px 24px;
    font-size: 16px;
    background: var(--bg-button);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

#browse-btn:hover {
    background: var(--bg-button-hover);
}

#browse-btn:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

#video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
}

.video-cell {
    position: absolute;
    background: var(--bg);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s;
}

.video-cell video,
.video-cell canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-cell.fit-contain video {
    object-fit: contain;
}

.video-cell .close-video-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
    padding: 2px 6px;
}

.video-cell.show-controls .close-video-btn {
    opacity: 0.7;
}

.video-cell .close-video-btn:hover {
    opacity: 1;
}

.video-cell .filename {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 40px;
    font-size: 12px;
    color: var(--text-ghost);
    text-shadow: 1px 1px 2px var(--bg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.video-cell.show-controls .filename {
    opacity: 1;
}

.video-cell.priority {
    box-shadow: inset 0 0 0 3px var(--accent-priority);
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, var(--bg-overlay));
    padding: 30px 10px 10px;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-cell.show-controls .video-controls {
    opacity: 1;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--progress-bg);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.progress-container:hover {
    height: 6px;
}

.progress-bar {
    height: 100%;
    background: var(--text);
    border-radius: 2px;
    width: 0%;
    pointer-events: none;
}

.control-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.nav-group .nav-shuffle {
    font-size: 20px;
}

.nav-group .nav-fs {
    font-size: 11px;
    opacity: 0.6;
}

.nav-group .nav-fs:hover {
    opacity: 1;
}

.center-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.2s, transform 0.2s;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.control-btn:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.control-btn.play-pause {
    font-size: 20px;
}

.time-display {
    font-size: 11px;
    color: var(--text-ghost);
    min-width: 70px;
    text-align: center;
}

#controls {
    position: fixed;
    top: 10px;
    right: 10px;
    background: var(--bg-overlay);
    padding: 15px;
    border-radius: 8px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    max-width: 300px;
}

#controls:hover,
#controls.visible {
    opacity: 1;
}

#controls h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

#controls .stat {
    margin: 5px 0;
    color: var(--text-muted);
}

#controls .stat span {
    color: var(--text);
    font-weight: bold;
}

.shortcuts {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.shortcuts div {
    margin: 3px 0;
    font-size: 12px;
    color: var(--text-dim);
}

.shortcuts kbd {
    background: var(--bg-button);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: var(--text);
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay-heavy);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    will-change: transform;
}

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

#loading-text {
    margin-top: 20px;
    font-size: 16px;
    opacity: 0.8;
}

#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(50, 50, 50, 0.95);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    z-index: 3000;
    transition: transform 0.3s ease;
}

#toast.visible {
    transform: translateX(-50%) translateY(0);
}

#skipped-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 12px;
    z-index: 2500;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    display: none;
    border: 1px solid var(--border);
}

#skipped-panel.visible {
    display: block;
}

#skipped-panel h3 {
    margin-bottom: 15px;
    color: var(--accent-error);
}

#skipped-panel .skipped-list {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

#skipped-panel .skipped-item {
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}

#skipped-panel .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

#skipped-panel .close-btn:hover {
    color: var(--text);
}

#skipped-panel .close-btn:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

#skipped-panel .empty-msg {
    color: #666;
    font-style: italic;
}
