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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    font-size: 2em;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
}

.game-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-cover {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.game-info {
    padding: 20px;
}

.game-info h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.platform-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 10px;
}

.file-size {
    color: #666;
    font-size: 0.9em;
}

.game-actions {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.btn-download, .btn-description {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-download {
    background: #10b981;
    color: white;
}

.btn-download:hover {
    background: #059669;
}

.btn-description {
    background: #3b82f6;
    color: white;
}

.btn-description:hover {
    background: #2563eb;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 32px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.file-browser {
    display: flex;
    gap: 10px;
}

.file-browser input {
    flex: 1;
}

.file-browser-container {
    margin-top: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.current-path {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.9em;
}

#upDirBtn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: #e5e7eb;
}

.file-item.selected {
    background: #dbeafe;
    border: 2px solid #3b82f6;
}

.file-item-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

/* Download Manager */
.download-manager {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 999;
    display: none;
}

.download-manager.active {
    display: block;
}

.dm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.dm-header h3 {
    margin: 0;
}

#minimizeDm {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.download-list {
    max-height: 300px;
    overflow-y: auto;
}

.download-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.download-item:last-child {
    border-bottom: none;
}

.download-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    width: 0%;
    transition: width 0.3s;
}

.download-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    color: #666;
}

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .download-manager {
        width: calc(100% - 40px);
        left: 20px;
    }
}