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

:root {
    --primary-color: #5e72e4;
    --primary-hover: #4c63d2;
    --secondary-color: #f5365c;
    --success-color: #2dce89;
    --warning-color: #fb6340;
    --info-color: #11cdef;
    --text-primary: #32325d;
    --text-secondary: #8898aa;
    --border-color: #e9ecef;
    --background: #f8f9fe;
    --card-background: #ffffff;
    --shadow-sm: 0 0 0.5rem rgba(0, 0, 0, 0.05);
    --shadow-md: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
}

.language-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    border-color: white;
}

main {
    animation: fadeIn 0.8s ease;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    background: white;
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.upload-area:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.upload-area.dragover {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-color: var(--primary-color);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-area h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.select-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(94, 114, 228, 0.3);
}

.select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(94, 114, 228, 0.4);
}

.files-list, .settings-section, .progress-section, .results-section {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.files-list h3, .settings-section h3, .progress-section h3, .results-section h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.files-container {
    max-height: 300px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--background);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.file-item:hover {
    background: #f0f2f5;
    transform: translateX(5px);
}

.file-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 1rem;
}

.remove-btn {
    width: 24px;
    height: 24px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
}

.remove-btn:hover {
    background: #ec2547;
    transform: rotate(90deg);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.setting-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#formatSelect {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

#formatSelect:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(94, 114, 228, 0.1);
}

.level-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#levelRange {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--success-color), var(--warning-color));
    outline: none;
}

#levelRange::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

#levelRange::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#levelValue {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 30px;
    text-align: center;
}

.level-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.compress-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--success-color), #26b76e);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 6px rgba(45, 206, 137, 0.3);
}

.compress-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(45, 206, 137, 0.4);
}

.compress-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--background);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--info-color), var(--primary-color));
    border-radius: 15px;
    transition: width 0.3s ease;
    box-shadow: 0 2px 10px rgba(94, 114, 228, 0.3);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

#progressText {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.size-comparison {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.size-item {
    text-align: center;
}

.size-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.size-item span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.size-item.highlight span {
    color: var(--success-color);
    font-size: 2rem;
}

.size-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.download-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(94, 114, 228, 0.3);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(94, 114, 228, 0.4);
}

.reset-btn {
    width: 100%;
    padding: 1rem;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.reset-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

footer {
    text-align: center;
    color: white;
    padding: 2rem;
    opacity: 0.9;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .size-comparison {
        flex-direction: column;
        gap: 1rem;
    }
    
    .size-arrow {
        transform: rotate(90deg);
    }
}