body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #111;
    color: white;
    text-align: center;
}

h1 {
    padding: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
}

.video-card {
    position: relative;
    cursor: pointer;
    background: #222;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.video-card:hover {
    transform: scale(1.03);
}

.video-card video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    pointer-events: none;
}

.video-title {
    padding: 8px;
    font-size: 12px;
    word-break: break-all;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none;
}

.modal-content {
    position: relative;
    width: 80%;
    max-width: 900px;
}

.modal-content video {
    width: 100%;
}

#closeBtn {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 30px;
    background: none;
    color: white;
    border: none;
    cursor: pointer;
}

.video-card {
    background: #222;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: 0.2s ease;
    border: 2px solid transparent;
}

.video-card:hover {
    background: #2c2c2c;
}

/* Viewed */
.video-card.viewed {
    border-color: #3498db;
    background: #1b2a38;
}

/* Downloaded */
.video-card.downloaded {
    border-color: #2ecc71;
    background: #1d3826;
}

/* Buttons */
.button-container {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

button {
    padding: 5px 10px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.open-btn {
    background: #3498db;
    color: white;
}

.download-btn {
    background: #2ecc71;
    color: white;
}
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #1a1a1a;
}

.controls {
    display: flex;
    gap: 10px;
}

.controls button {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#downloadAllBtn {
    background: #e67e22;
    color: white;
}

#resetHistoryBtn {
    background: #c0392b;
    color: white;
}

