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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    padding: 40px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin: 0;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.language-switcher {
    display: flex;
    align-items: center;
    position: absolute;
    right: 0;
}

.language-select {
    padding: 6px 12px;
    font-size: 0.875rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.language-select:hover {
    border-color: #667eea;
}

.language-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.subtitle {
    color: #666;
    font-size: 1rem;
}

.search-section {
    width: 100%;
}

.search-box-container {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: #667eea;
}

.search-history {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

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

.search-history-item:hover {
    background-color: #f5f5f5;
}

.search-history-text {
    flex: 1;
    color: #333;
    font-size: 0.9375rem;
    user-select: none;
}

.search-history-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #999;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.search-history-delete:hover {
    color: #ff4444;
    background-color: #fff5f5;
    opacity: 1;
}

.search-button {
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.search-button:active {
    transform: translateY(0);
}

.engines-section {
    border-top: 1px solid #e0e0e0;
    padding-top: 30px;
}

.engines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.engines-header h2 {
    font-size: 1.25rem;
    color: #333;
    font-weight: 600;
}

.select-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.engines-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.engine-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.engine-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.engine-group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.engine-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.engine-item:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.engine-item.selected {
    background: #e8edff;
    border-color: #667eea;
}

.engine-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.engine-group-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.engine-label {
    font-size: 0.9375rem;
    color: #333;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

.engine-search-link,
.engine-homepage-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 6px;
    color: #999;
    text-decoration: none;
    opacity: 0.6;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.engine-search-link:hover,
.engine-homepage-link:hover {
    color: #667eea;
    opacity: 1;
    transform: scale(1.1);
}

.engine-item:hover .engine-search-link,
.engine-item:hover .engine-homepage-link {
    opacity: 0.8;
}

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    color: #666;
    font-size: 0.875rem;
}

footer code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
}

@media (max-width: 600px) {
    .container {
        padding: 24px;
    }
    
    .header-top {
        flex-direction: column;
        gap: 12px;
        align-items: center;
        position: relative;
    }
    
    header h1 {
        font-size: 2rem;
        text-align: center;
    }
    
    .language-switcher {
        position: static;
        width: 100%;
        justify-content: center;
    }
    
    .language-select {
        width: 120px;
    }
    
    .search-box-container {
        flex-direction: column;
    }
    
    .search-history {
        max-height: 200px;
    }
    
    .search-history-item {
        padding: 10px 12px;
    }
    
    .engines-list {
        grid-template-columns: 1fr;
    }
    
    .engines-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

